re PR tree-optimization/56426 (Segmentation fault in find_var_scev_info, at tree...
authorMarek Polacek <polacek@redhat.com>
Tue, 26 Feb 2013 11:06:14 +0000 (11:06 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 26 Feb 2013 11:06:14 +0000 (11:06 +0000)
2013-02-26  Marek Polacek  <polacek@redhat.com>

        PR tree-optimization/56426
        * tree-ssa-loop.c (tree_ssa_loop_init): Always call
        scev_initialize.

From-SVN: r196281

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56436.c [new file with mode: 0644]
gcc/tree-ssa-loop.c

index c2accb7..ebd19f7 100644 (file)
@@ -1,3 +1,9 @@
+2013-02-26  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/56426
+       * tree-ssa-loop.c (tree_ssa_loop_init): Always call
+       scev_initialize.
+
 2013-02-26  Richard Biener  <rguenther@suse.de>
 
        PR target/56444
index 1da7b6f..9f00b87 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-26  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/56426
+       * gcc.dg/pr56436.c: New test.
+
 2013-02-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/56448
diff --git a/gcc/testsuite/gcc.dg/pr56436.c b/gcc/testsuite/gcc.dg/pr56436.c
new file mode 100644 (file)
index 0000000..cae4d2a
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/56426 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, *c;
+
+void
+f (void)
+{
+  int b = 0;
+
+  for (a = 0;; a++)
+    if (--b)
+      {
+       if (a)
+       lbl:
+         a++;
+
+       c = &b;
+       goto lbl;
+      }
+}
index f4a2704..edc04ea 100644 (file)
@@ -70,10 +70,13 @@ tree_ssa_loop_init (void)
                       | LOOPS_HAVE_RECORDED_EXITS);
   rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
 
+  /* We might discover new loops, e.g. when turning irreducible
+     regions into reducible.  */
+  scev_initialize ();
+
   if (number_of_loops () <= 1)
     return 0;
 
-  scev_initialize ();
   return 0;
 }