From: Richard Guenther Date: Sun, 29 May 2011 17:03:38 +0000 (+0000) Subject: re PR tree-optimization/49217 (Wrong optimization of code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=61e374ab766ee2ed03093656f04ca7e8228a3450;p=gcc.git re PR tree-optimization/49217 (Wrong optimization of code) 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. From-SVN: r174400 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0dfe67a0f1d..d573409707d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-29 Richard Guenther + + PR tree-optimization/49217 + * ipa-pure-const.c (propagate_pure_const): Fix typos. + 2011-05-28 Jan Hubicka * lto-streamer-out.c (hash_string_slot_node): Hash string based on its diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 4034d57621d..74cf52a896e 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -1225,7 +1225,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; @@ -1248,7 +1248,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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eb55295310e..ffd768192c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-29 Richard Guenther + + PR tree-optimization/49217 + * gcc.dg/torture/pr49217.c: New testcase. + 2011-05-29 Ira Rosen PR testsuite/49222 diff --git a/gcc/testsuite/gcc.dg/torture/pr49217.c b/gcc/testsuite/gcc.dg/torture/pr49217.c new file mode 100644 index 00000000000..e8a89de8f5d --- /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; +}