diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-12-12 10:32:52 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-12-12 10:32:52 +0100 |
commit | 4c052539b6f9b5c5332d01e7dbc2c04e2477db85 (patch) | |
tree | abacd9867efaa65406be7e3d847cae7417fe04a3 /gcc/tree-ssa-loop-niter.c | |
parent | 4e74424074a80791ef6ba223d56b1af3f9ac4439 (diff) | |
download | gcc-4c052539b6f9b5c5332d01e7dbc2c04e2477db85.zip gcc-4c052539b6f9b5c5332d01e7dbc2c04e2477db85.tar.gz gcc-4c052539b6f9b5c5332d01e7dbc2c04e2477db85.tar.bz2 |
re PR fortran/55633 (FAIL: gfortran.dg/g77/f90-intrinsic-bit.f -Os execution test)
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.
From-SVN: r194438
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 d3007d7..a9b7077 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)) |