]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/58539 (ICE with segfault at -O3 with -g enabled on x86_64...
authorRichard Biener <rguenther@suse.de>
Thu, 26 Sep 2013 12:45:19 +0000 (12:45 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 26 Sep 2013 12:45:19 +0000 (12:45 +0000)
2013-09-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/58539
* tree-vect-loop.c (vect_create_epilog_for_reduction): Honor
the fact that debug statements are not taking part in loop-closed
SSA construction.

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

From-SVN: r202942

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr58539.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index b9d4c358bef27f66c514d952411d849a45c72547..90feb2c573995675571694caa92cb87ed977cba5 100644 (file)
@@ -1,3 +1,10 @@
+2013-09-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58539
+       * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor
+       the fact that debug statements are not taking part in loop-closed
+       SSA construction.
+
 2013-09-26  Nick Clifton  <nickc@redhat.com>
 
        * config/msp430/msp430.c (msp430_expand_epilogue): Fix compile
index a72615cb5d507fb1d6d42c21a4b62d464e587b95..065eebd55569ccdd77569684996fc5c309080736 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58539
+       * gcc.dg/torture/pr58539.c: New testcase.
+
 2013-09-25  Jeff Law  <law@redhat.com>
 
        * gcc.dg/tree-ssa/ssa-dom-thread-3.c: Update expected output.
diff --git a/gcc/testsuite/gcc.dg/torture/pr58539.c b/gcc/testsuite/gcc.dg/torture/pr58539.c
new file mode 100644 (file)
index 0000000..a016150
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+int a, b;
+
+extern void baz (int);
+
+int foo (int p)
+{
+  return p ? p : 1;
+}
+
+void bar ()
+{
+  int *c = &a, *d = &a;
+  for (b = 0; b < 12; b++)
+    *d |= 1;
+  foo (*c);
+  baz (*c && 1);
+}
index 2871ba1ce751501f37f577acc46aad16a4ebcbb0..072d44ef2b26e10479acf1722942f7a24ccb5697 100644 (file)
@@ -4411,7 +4411,8 @@ vect_finalize_reduction:
          result.  (The reduction result is expected to have two immediate uses -
          one at the latch block, and one at the loop exit).  */
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
-        if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
+        if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))
+           && !is_gimple_debug (USE_STMT (use_p)))
           phis.safe_push (USE_STMT (use_p));
 
       /* While we expect to have found an exit_phi because of loop-closed-ssa
@@ -4541,7 +4542,10 @@ vect_finalize_reduction:
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
         {
           if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
-            phis.safe_push (USE_STMT (use_p));
+           {
+             if (!is_gimple_debug (USE_STMT (use_p)))
+               phis.safe_push (USE_STMT (use_p));
+           }
           else
             {
               if (double_reduc && gimple_code (USE_STMT (use_p)) == GIMPLE_PHI)
@@ -4551,7 +4555,8 @@ vect_finalize_reduction:
                   FOR_EACH_IMM_USE_FAST (phi_use_p, phi_imm_iter, phi_res)
                     {
                       if (!flow_bb_inside_loop_p (loop,
-                                             gimple_bb (USE_STMT (phi_use_p))))
+                                             gimple_bb (USE_STMT (phi_use_p)))
+                         && !is_gimple_debug (USE_STMT (phi_use_p)))
                         phis.safe_push (USE_STMT (phi_use_p));
                     }
                 }