re PR tree-optimization/49000 (ICE: verify_ssa failed with -O2 -g)
authorJakub Jelinek <jakub@redhat.com>
Wed, 18 May 2011 09:22:41 +0000 (11:22 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 18 May 2011 09:22:41 +0000 (11:22 +0200)
PR tree-optimization/49000
* tree-ssa.c (execute_update_addresses_taken): Call
maybe_rewrite_mem_ref_base on debug stmt value.  If it couldn't
be rewritten and decl has been marked for renaming, reset
the debug stmt.

* gcc.dg/pr49000.c: New test.

From-SVN: r173849

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr49000.c [new file with mode: 0644]
gcc/tree-ssa.c

index 4540ec42c8970554c504a2674a4b553fb8ab6ee7..f3e55e8592e22f428288ebb337fd46122ac8d789 100644 (file)
@@ -1,3 +1,11 @@
+2011-05-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/49000
+       * tree-ssa.c (execute_update_addresses_taken): Call
+       maybe_rewrite_mem_ref_base on debug stmt value.  If it couldn't
+       be rewritten and decl has been marked for renaming, reset
+       the debug stmt.
+
 2011-05-17  Joseph Myers  <joseph@codesourcery.com>
 
        * config/i386/i386.c (ix86_valid_target_attribute_tree): Use
index 841c72d8d2952cdf4881dc49afc6eebb928f89b2..df63223a7d6c2a4bd7383dd71f540043f0cc4646 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/49000
+       * gcc.dg/pr49000.c: New test.
+
 2011-05-17  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/invalid1.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/pr49000.c b/gcc/testsuite/gcc.dg/pr49000.c
new file mode 100644 (file)
index 0000000..32a1cdb
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR tree-optimization/49000 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+static
+foo (int x, int y)
+{
+  return x * y;
+}
+
+static int
+bar (int *z)
+{
+  return *z;
+}
+
+void
+baz (void)
+{
+  int a = 42;
+  int *b = &a;
+  foo (bar (&a), 3);
+}
+
+void
+test (void)
+{
+  baz ();
+}
index f596fcd870ca8f13feb031131133c26d9d5b2480..ba5a20b6e476d27aa7ff36d274a5c05ad4e4e4eb 100644 (file)
@@ -2230,6 +2230,17 @@ execute_update_addresses_taken (void)
                  }
              }
 
+           else if (gimple_debug_bind_p (stmt)
+                    && gimple_debug_bind_has_value_p (stmt))
+             {
+               tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
+               tree decl;
+               maybe_rewrite_mem_ref_base (valuep);
+               decl = non_rewritable_mem_ref_base (*valuep);
+               if (decl && symbol_marked_for_renaming (decl))
+                 gimple_debug_bind_reset_value (stmt);
+             }
+
            if (gimple_references_memory_p (stmt)
                || is_gimple_debug (stmt))
              update_stmt (stmt);