re PR middle-end/67120 (wrong code for volatile pointers at -O1 and above on x86_64...
authorRichard Biener <rguenther@suse.de>
Wed, 5 Aug 2015 12:47:59 +0000 (12:47 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 5 Aug 2015 12:47:59 +0000 (12:47 +0000)
2015-08-05  Richard Biener  <rguenther@suse.de>

PR middle-end/67120
* match.pd: Compare address bases with == if they are decls
or SSA names, not operand_equal_p.  Otherwise fail.

* gcc.dg/torture/pr67120.c: New testcase.

From-SVN: r226623

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr67120.c [new file with mode: 0644]

index ff02e192470772b59a43c4ef7bb9bad44420b5c4..349bbcb8f38ee7ed4fbe25b291183e8e8ce73fb7 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-05  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/67120
+       * match.pd: Compare address bases with == if they are decls
+       or SSA names, not operand_equal_p.  Otherwise fail.
+
 2015-08-05  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/67055
index 2a4f7d698e41dd0a753f9d9ac372c91104c7b44c..4230f9a7d18164bd606d86c484ac81938163a9e4 100644 (file)
@@ -1848,13 +1848,14 @@ along with GCC; see the file COPYING3.  If not see
    (if (base0 && base1)
     (with
      {
-       int equal;
+       int equal = 2;
        if (decl_in_symtab_p (base0)
           && decl_in_symtab_p (base1))
          equal = symtab_node::get_create (base0)
                   ->equal_address_to (symtab_node::get_create (base1));
-       else
-         equal = operand_equal_p (base0, base1, 0);
+       else if ((DECL_P (base0) || TREE_CODE (base0) == SSA_NAME)
+               && (DECL_P (base1) || TREE_CODE (base1) == SSA_NAME))
+         equal = (base0 == base1);
      }
      (if (equal == 1
          && (cmp == EQ_EXPR || cmp == NE_EXPR
index d1bb135d8bb0d9dd8267544e6f57447c3f890e7d..61d98486c1ec246a76c64da9a6cd508df7661d4e 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-05  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/67120
+       * gcc.dg/torture/pr67120.c: New testcase.
+
 2015-08-05  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/52846
diff --git a/gcc/testsuite/gcc.dg/torture/pr67120.c b/gcc/testsuite/gcc.dg/torture/pr67120.c
new file mode 100644 (file)
index 0000000..d22b314
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+volatile int *volatile *a;
+static volatile int *volatile **b = &a;
+
+int
+main ()
+{
+  volatile int *volatile c;
+  *b = &c;
+
+  if (a != &c) 
+    __builtin_abort (); 
+
+  return 0;
+}