]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/46491 (ipa-pure-const.c miscompilation)
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Apr 2011 21:25:47 +0000 (23:25 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Apr 2011 21:25:47 +0000 (23:25 +0200)
PR tree-optimization/46491
Backported from mainline
2010-05-14  Jan Hubicka  <jh@suse.cz>
* ipa-pure-const.c (check_stmt): Do not use memory_identifier_string.

2011-04-07  Jakub Jelinek  <jakub@redhat.com>

Backported from mainline
2010-11-15  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/46491
* gcc.target/i386/pr46491.c: New test.

From-SVN: r172129

gcc/ChangeLog
gcc/ipa-pure-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr46491.c [new file with mode: 0644]

index 6f42264284c5f3bc982ee6e22566a1725c01cdc7..f28377a9623ebfa6e7b4b2114e8c3de19ebcfd69 100644 (file)
@@ -1,3 +1,11 @@
+2011-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46491
+       Backported from mainline
+       2010-05-14  Jan Hubicka  <jh@suse.cz>
+
+       * ipa-pure-const.c (check_stmt): Do not use memory_identifier_string.
+
 2011-03-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline
index f21638f383eb1b977064f2de549e950b2e9acdcc..4f84fb6fc1e6ea57d52338b95b3fb71f3b388f9a 100644 (file)
@@ -360,7 +360,7 @@ get_asm_expr_operands (funct_state local, gimple stmt)
   for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
     {
       op = gimple_asm_clobber_op (stmt, i);
-      if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == 1) 
+      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "memory") == 0)
        /* Abandon all hope, ye who enter here. */
        local->pure_const_state = IPA_NEITHER;
     }
index 78953d898b129db48bccfb17b743bba7eb4bf3bd..d4904a60e2c62f8be9c50eddb533445cf034742c 100644 (file)
@@ -1,3 +1,11 @@
+2011-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2010-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46491
+       * gcc.target/i386/pr46491.c: New test.
+
 2011-03-09  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/nontype22.C: New.
diff --git a/gcc/testsuite/gcc.target/i386/pr46491.c b/gcc/testsuite/gcc.target/i386/pr46491.c
new file mode 100644 (file)
index 0000000..cd4c3f2
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/46491 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-ipa-reference" } */
+
+extern void abort (void);
+
+__attribute__((noinline)) int
+foo (int *p)
+{
+  int r;
+  asm ("movl $6, (%1)\n\txorl %0, %0" : "=r" (r) : "r" (p) : "memory");
+  return r;
+}
+
+int
+main (void)
+{
+  int p = 8;
+  if ((foo (&p) ? : p) != 6)
+    abort ();
+  return 0;
+}