]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/46491 (ipa-pure-const.c miscompilation)
authorJakub Jelinek <jakub@redhat.com>
Mon, 15 Nov 2010 22:27:24 +0000 (23:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Nov 2010 22:27:24 +0000 (23:27 +0100)
PR tree-optimization/46491
Backport from mainline

2010-05-14  Jan Hubicka  <jh@suse.cz>
* ipa-pure-const.c (check_stmt): Do not use memory_identifier_string.

* gcc.target/i386/pr46491.c: New test.

From-SVN: r166774

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

index 73938f970e6991db2da2657b2d7bdc5dfbaa89a5..2979a97268f4f262176a96e1023429ac094f2a98 100644 (file)
@@ -1,3 +1,11 @@
+2010-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46491
+       Backport from mainline
+
+       2010-05-14  Jan Hubicka  <jh@suse.cz>
+       * ipa-pure-const.c (check_stmt): Do not use memory_identifier_string.
+
 2010-11-12  Olivier Hainque  <hainque@adacore.com>
 
        * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Rewrite
index da9d5d635548168fa7013e5521dba25f2271a4ba..ba27848f4cde5ac0f3041c39d5c89b8e14d1d2b3 100644 (file)
@@ -460,7 +460,7 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
       for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
        {
          tree 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)
            {
               if (dump_file)
                 fprintf (dump_file, "    memory asm clobber is not const/pure");
index 59867e3b682a890ae174a656b38e7db5c6184132..cf2f8f1861cda3d55d72669634b93be6e5b7ce39 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46491
+       * gcc.target/i386/pr46491.c: New test.
+
 2010-11-13  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/45742
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..82f704c
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/46491 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+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;
+}