| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
#ifdef __SIZEOF_INT128__ |
| 5 |
#define T __int128 |
| 6 |
#else |
| 7 |
#define T long long |
| 8 |
#endif |
| 9 |
|
| 10 |
extern void impossible (void); |
| 11 |
|
| 12 |
void f(T x) |
| 13 |
{ |
| 14 |
unsigned T y; |
| 15 |
unsigned T z; |
| 16 |
if (x < -7) |
| 17 |
return; |
| 18 |
if (x > 2) |
| 19 |
return; |
| 20 |
y = x; |
| 21 |
z = y * y; |
| 22 |
if (z == 666) |
| 23 |
impossible (); |
| 24 |
} |
| 25 |
|
| 26 |
void g(unsigned T x) |
| 27 |
{ |
| 28 |
unsigned T y; |
| 29 |
unsigned T z; |
| 30 |
unsigned T m = -1; |
| 31 |
m = m / 2; |
| 32 |
if (x < m-2) |
| 33 |
return; |
| 34 |
if (x > m-1) |
| 35 |
return; |
| 36 |
y = x; |
| 37 |
z = y * y; |
| 38 |
/* The product (ignoring it is a square) has only 3 possible values: |
| 39 |
4, 9 and 2^127+6. At least one of the values 7, 666 and -666 is |
| 40 |
known to be impossible. 7 is the most logical in the current |
| 41 |
implementation. */ |
| 42 |
if (z == 7) |
| 43 |
impossible (); |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-final { scan-tree-dump-not "impossible" "optimized" } } */ |