diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-12 09:32:52 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-12 09:32:52 +0000 |
commit | cc2263b151d5eb3bf06dcd774a07a088bfdda296 (patch) | |
tree | abacd9867efaa65406be7e3d847cae7417fe04a3 /gcc/tree-ssa-loop-niter.c | |
parent | 6bdcaadb560c48a930bb0e6ca23b09ee66161d55 (diff) | |
download | ppe42-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.c | 14 |
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)) |