summaryrefslogtreecommitdiffstats
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-12 09:32:52 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-12 09:32:52 +0000
commitcc2263b151d5eb3bf06dcd774a07a088bfdda296 (patch)
treeabacd9867efaa65406be7e3d847cae7417fe04a3 /gcc/tree-ssa-loop-niter.c
parent6bdcaadb560c48a930bb0e6ca23b09ee66161d55 (diff)
downloadppe42-gcc-cc2263b151d5eb3bf06dcd774a07a088bfdda296.tar.gz
ppe42-gcc-cc2263b151d5eb3bf06dcd774a07a088bfdda296.zip
PR fortran/55633
* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Ignore bounds on which bound += double_int_one overflowed. * gcc.dg/torture/pr55633.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194438 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index d3007d78aec..a9b70778952 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -3011,7 +3011,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
/* Exit terminates loop at given iteration, while non-exits produce undefined
effect on the next iteration. */
if (!elt->is_exit)
- bound += double_int_one;
+ {
+ bound += double_int_one;
+ /* If an overflow occurred, ignore the result. */
+ if (bound.is_zero ())
+ continue;
+ }
if (!loop->any_upper_bound
|| bound.ult (loop->nb_iterations_upper_bound))
@@ -3037,7 +3042,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
{
double_int bound = elt->bound;
if (!elt->is_exit)
- bound += double_int_one;
+ {
+ bound += double_int_one;
+ /* If an overflow occurred, ignore the result. */
+ if (bound.is_zero ())
+ continue;
+ }
if (!loop->any_upper_bound
|| bound.ult (loop->nb_iterations_upper_bound))
OpenPOWER on IntegriCloud