From d5ea0b26fccb8359f0edce472053beca74f50f93 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 29 May 2011 17:00:13 +0000 Subject: [PATCH] 2011-05-29 Richard Guenther PR tree-optimization/49217 * ipa-pure-const.c (propagate_pure_const): Fix typos. * gcc.dg/torture/pr49217.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174399 138bc75d-0d04-0410-961f-82ee72b054a4 index 3b4cc02..b9476e6 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -1223,7 +1223,7 @@ propagate_pure_const (void) break; /* Now process the indirect call. */ - for (ie = node->indirect_calls; ie; ie = ie->next_callee) + for (ie = w->indirect_calls; ie; ie = ie->next_callee) { enum pure_const_state_e edge_state = IPA_CONST; bool edge_looping = false; @@ -1246,7 +1246,7 @@ propagate_pure_const (void) break; /* And finally all loads and stores. */ - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++) + for (i = 0; ipa_ref_list_reference_iterate (&w->ref_list, i, ref); i++) { enum pure_const_state_e ref_state = IPA_CONST; bool ref_looping = false; new file mode 100644 index 0000000..e8a89de --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr49217.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-fno-early-inlining" } */ + +extern void abort (void); +int i; +static void foo(void); +void __attribute__((noinline)) +bar (void) +{ + if (!i) + foo (); +} +static void +foo(void) +{ + i = 1; + bar (); +} +int main() +{ + i = 0; + bar(); + if (i != 1) + abort (); + return 0; +} -- 1.7.0.4