This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR46355
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Nov 2010 17:52:04 +0100 (CET)
- Subject: [PATCH] Fix PR46355
This fixes PR46355, we ICE trying to distribute an infinite loop.
Don't even try.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c (revision 166492)
--- gcc/tree-loop-distribution.c (working copy)
*************** tree_loop_distribution (void)
*** 1145,1151 ****
FOR_EACH_LOOP (li, loop, 0)
{
! VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3);
/* If both flag_tree_loop_distribute_patterns and
flag_tree_loop_distribution are set, then only
--- 1145,1156 ----
FOR_EACH_LOOP (li, loop, 0)
{
! VEC (gimple, heap) *work_list = NULL;
!
! /* If the loop doesn't have a single exit we will fail anyway,
! so do that early. */
! if (!single_exit (loop))
! continue;
/* If both flag_tree_loop_distribute_patterns and
flag_tree_loop_distribution are set, then only
Index: gcc/testsuite/gcc.dg/pr46355.c
===================================================================
*** gcc/testsuite/gcc.dg/pr46355.c (revision 0)
--- gcc/testsuite/gcc.dg/pr46355.c (revision 0)
***************
*** 0 ****
--- 1,14 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -ftree-loop-distribution -fstrict-overflow" } */
+
+ void
+ foo (int *dest, int i, int u, int v)
+ {
+ int j = i;
+ while (i)
+ {
+ dest[j--] = v;
+ dest[j--] = u;
+ }
+ }
+