| 1 |
/* { dg-require-effective-target alarm } */ |
| 2 |
/* { dg-require-effective-target signal } */ |
| 3 |
/* { dg-additional-options "-O3" } */ |
| 4 |
#include <limits.h> |
| 5 |
#include "pr101145inf.inc" |
| 6 |
|
| 7 |
__attribute__ ((noinline)) |
| 8 |
unsigned foo(unsigned val, unsigned start) |
| 9 |
{ |
| 10 |
unsigned cnt = 0; |
| 11 |
for (unsigned i = start; val <= i; i+=16) |
| 12 |
cnt++; |
| 13 |
return cnt; |
| 14 |
} |
| 15 |
|
| 16 |
void test_finite () |
| 17 |
{ |
| 18 |
unsigned n = foo (16, UINT_MAX - 32); |
| 19 |
if (n != 3) |
| 20 |
__builtin_abort (); |
| 21 |
} |
| 22 |
|
| 23 |
void test_infinite () |
| 24 |
{ |
| 25 |
foo (15, UINT_MAX - 32); |
| 26 |
} |