Commit 4c052539 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 4e744240
2012-12-12 Jakub Jelinek <jakub@redhat.com>
PR fortran/55633
* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk):
Ignore bounds on which bound += double_int_one overflowed.
2012-12-11 Eric Botcazou <ebotcazou@adacore.com> 2012-12-11 Eric Botcazou <ebotcazou@adacore.com>
PR target/54121 PR target/54121
2012-12-12 Jakub Jelinek <jakub@redhat.com>
PR fortran/55633
* gcc.dg/torture/pr55633.c: New test.
2012-12-11 Marc Glisse <marc.glisse@inria.fr> 2012-12-11 Marc Glisse <marc.glisse@inria.fr>
PR c++/53094 PR c++/53094
......
/* PR fortran/55633 */
/* { dg-do run { target int128 } } */
extern void abort (void);
__attribute__((noinline, noclone)) void
bar (__int128_t *x)
{
int c = sizeof (__int128_t) * __CHAR_BIT__;
if (c > 127)
c = 127;
if (*x != c)
abort ();
}
__attribute__((noinline)) void
foo (void)
{
__int128_t m, ma;
ma = 0;
m = 0;
m = ~m;
do
{
if (m == 0 || ma > 126)
break;
ma = ma + 1;
m = ((__uint128_t) m) >> 1;
}
while (1);
bar (&ma);
}
int
main ()
{
foo ();
return 0;
}
...@@ -3011,7 +3011,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop) ...@@ -3011,7 +3011,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
/* Exit terminates loop at given iteration, while non-exits produce undefined /* Exit terminates loop at given iteration, while non-exits produce undefined
effect on the next iteration. */ effect on the next iteration. */
if (!elt->is_exit) 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 if (!loop->any_upper_bound
|| bound.ult (loop->nb_iterations_upper_bound)) || bound.ult (loop->nb_iterations_upper_bound))
...@@ -3037,7 +3042,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop) ...@@ -3037,7 +3042,12 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
{ {
double_int bound = elt->bound; double_int bound = elt->bound;
if (!elt->is_exit) 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 if (!loop->any_upper_bound
|| bound.ult (loop->nb_iterations_upper_bound)) || bound.ult (loop->nb_iterations_upper_bound))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment