]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/45449 (-fcompare-debug failure with -O2 -fno-tree-pre -fno...
authorRichard Guenther <rguenther@suse.de>
Mon, 30 Aug 2010 11:13:05 +0000 (11:13 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 30 Aug 2010 11:13:05 +0000 (11:13 +0000)
2010-08-30  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/45449
* tree-ssa-live.c (remove_unused_locals): Also remove address-taken
variables.

* gcc.dg/pr45449.c: New testcase.

From-SVN: r163638

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

index 37106bff88423310724c0fddf85a9161b9542330..e4e5f4c298120aef5aa8f5cb0bcb65c78be5b875 100644 (file)
@@ -1,3 +1,9 @@
+2010-08-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/45449
+       * tree-ssa-live.c (remove_unused_locals): Also remove address-taken
+       variables.
+
 2010-08-30  Joseph Myers  <joseph@codesourcery.com>
 
        * opts.h (CL_ERR_NEGATIVE): Define.
index 984c2f45ef20b57507b22d3cc5fe533ebd6339f7..f01e477c3c622d3525c34710a728403e7437f962 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/45449
+       * gcc.dg/pr45449.c: New testcase.
+
 2010-08-30  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/opts-1.c: Expect errors, not warnings.
diff --git a/gcc/testsuite/gcc.dg/pr45449.c b/gcc/testsuite/gcc.dg/pr45449.c
new file mode 100644 (file)
index 0000000..d7b69a1
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-pre -fno-tree-pta -fcompare-debug" } */
+
+struct S
+{
+};
+
+void
+baz (void)
+{
+  struct S s;
+  &s;
+}
+
+int bar (void);
+
+void
+foo (void)
+{
+  if (bar ())
+    baz ();
+}
index 1eb6822149536ad901e0599ecc43d940b45afa03..821be7f2a8eb9939dbaae0bfba58a78f0bc866b2 100644 (file)
@@ -813,18 +813,13 @@ remove_unused_locals (void)
       BITMAP_FREE (global_unused_vars);
     }
 
-  /* Remove unused variables from REFERENCED_VARs.  As a special
-     exception keep the variables that are believed to be aliased.
-     Those can't be easily removed from the alias sets and operand
-     caches.  They will be removed shortly after the next may_alias
-     pass is performed.  */
+  /* Remove unused variables from REFERENCED_VARs.  */
   FOR_EACH_REFERENCED_VAR (t, rvi)
     if (!is_global_var (t)
        && TREE_CODE (t) != PARM_DECL
        && TREE_CODE (t) != RESULT_DECL
        && !(ann = var_ann (t))->used
-       && !ann->is_heapvar
-       && !TREE_ADDRESSABLE (t))
+       && !ann->is_heapvar)
       remove_referenced_var (t);
   remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
   if (dump_file && (dump_flags & TDF_DETAILS))