re PR tree-optimization/19853 (incorrect vops after exposing a new global variable)
authorDiego Novillo <dnovillo@gcc.gnu.org>
Mon, 14 Feb 2005 19:46:08 +0000 (14:46 -0500)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Mon, 14 Feb 2005 19:46:08 +0000 (14:46 -0500)
PR tree-optimization/19853
* tree-dfa.c (add_referenced_var): Always examine DECL_INITIAL.

testsuite/ChangeLog

PR tree-optimization/19853
* gcc.c-torture/compile/pr19853.c: New test.

From-SVN: r95040

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr19853.c [new file with mode: 0644]
gcc/tree-dfa.c

index 50289f2..e20036f 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-14  Diego Novillo  <dnovillo@redhat.com>
+
+       PR tree-optimization/19853
+       * tree-dfa.c (add_referenced_var): Always examine DECL_INITIAL.
+
 2005-02-14  Kazu Hirata  <kazu@cs.umass.edu>
 
        * passes.c (rest_of_handle_loop_optimize): Remove calls to
@@ -9,7 +14,7 @@
        swapping commutative operands.
 
 2005-02-14  Sebastian Pop  <pop@cri.ensmp.fr>
-        
+
        * lambda-code.c (lambda_loopnest_to_gcc_loopnest, perfect_nestify):
        Use standard_iv_increment_position for computing the bsi position
        for create_iv.
 2005-02-13  Zdenek Dvorak  <dvorakz@suse.cz>
 
        PR target/17428
-       * cfgrtl.c (safe_insert_insn_on_edge): Avoid extending life range of hard
-       registers.
-       * value-prof.c (insn_prefetch_values_to_profile): Only scan normal insns.
+       * cfgrtl.c (safe_insert_insn_on_edge): Avoid extending
+       life range of hard registers.
+       * value-prof.c (insn_prefetch_values_to_profile): Only
+       scan normal insns.
 
        * value-prof.c (rtl_find_values_to_profile): Do not look for values to
        profile in libcalls.
index 8384855..308cbe9 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-14  Diego Novillo  <dnovillo@redhat.com>
+
+       PR tree-optimization/19853
+       * gcc.c-torture/compile/pr19853.c: New test.
+
 2005-02-14  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/19608
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19853.c b/gcc/testsuite/gcc.c-torture/compile/pr19853.c
new file mode 100644 (file)
index 0000000..f7fdf49
--- /dev/null
@@ -0,0 +1,19 @@
+struct test { int *x; } global_test;
+int global_int;
+
+int flag;
+
+void test (char *dummy)
+{
+  static const struct test const_test = { &global_int };
+  struct test local_test;
+
+  int i;
+  for (i = 0; i < 1; i++)
+    *dummy = 0;
+  if (flag)
+    __builtin_memset (dummy, 0, 16);
+
+  local_test = const_test;
+  global_test = local_test;
+}
index d7ccd69..0d07ded 100644 (file)
@@ -901,8 +901,7 @@ add_referenced_var (tree var, struct walk_state *walk_state)
       /* Scan DECL_INITIAL for pointer variables as they may contain
         address arithmetic referencing the address of other
         variables.  */
-      if (DECL_INITIAL (var)
-         && POINTER_TYPE_P (TREE_TYPE (var)))
+      if (DECL_INITIAL (var))
        walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
     }
 }