From 9a06c1cb104070709c61f3c6cf8b913cd25f63d0 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Mon, 14 Feb 2005 14:46:08 -0500 Subject: [PATCH] re PR tree-optimization/19853 (incorrect vops after exposing a new global variable) 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 | 14 ++++++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr19853.c | 19 +++++++++++++++++++ gcc/tree-dfa.c | 3 +-- 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19853.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50289f2a290..e20036f273a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Diego Novillo + + PR tree-optimization/19853 + * tree-dfa.c (add_referenced_var): Always examine DECL_INITIAL. + 2005-02-14 Kazu Hirata * passes.c (rest_of_handle_loop_optimize): Remove calls to @@ -9,7 +14,7 @@ swapping commutative operands. 2005-02-14 Sebastian Pop - + * lambda-code.c (lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use standard_iv_increment_position for computing the bsi position for create_iv. @@ -19,9 +24,10 @@ 2005-02-13 Zdenek Dvorak 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. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8384855351f..308cbe981b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Diego Novillo + + PR tree-optimization/19853 + * gcc.c-torture/compile/pr19853.c: New test. + 2005-02-14 Nathan Sidwell 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 index 00000000000..f7fdf49bcfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19853.c @@ -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; +} diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index d7ccd69d7cf..0d07ded7a43 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -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); } }