re PR tree-optimization/49217 (Wrong optimization of code)
authorRichard Guenther <rguenther@suse.de>
Sun, 29 May 2011 17:03:38 +0000 (17:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 29 May 2011 17:03:38 +0000 (17:03 +0000)
2011-05-29  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/49217
* ipa-pure-const.c (propagate_pure_const): Fix typos.

* gcc.dg/torture/pr49217.c: New testcase.

From-SVN: r174400

gcc/ChangeLog
gcc/ipa-pure-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr49217.c [new file with mode: 0644]

index 0dfe67a..d573409 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-29  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49217
+       * ipa-pure-const.c (propagate_pure_const): Fix typos.
+
 2011-05-28  Jan Hubicka  <jh@suse.cz>
 
        * lto-streamer-out.c (hash_string_slot_node): Hash string based on its
index 4034d57..74cf52a 100644 (file)
@@ -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;
index eb55295..ffd7681 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-29  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49217
+       * gcc.dg/torture/pr49217.c: New testcase.
+
 2011-05-29  Ira Rosen  <ira.rosen@linaro.org>
 
        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 (file)
index 0000000..e8a89de
--- /dev/null
@@ -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;
+}