| 1 |
/* PR tree-optimization/123864 */ |
| 2 |
|
| 3 |
[[gnu::noipa]] static int |
| 4 |
foo (long long x) |
| 5 |
{ |
| 6 |
return __builtin_mul_overflow_p (x, ~0U, x); |
| 7 |
} |
| 8 |
|
| 9 |
int |
| 10 |
main () |
| 11 |
{ |
| 12 |
if (foo (0)) |
| 13 |
__builtin_abort (); |
| 14 |
#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 && __CHAR_BIT__ == 8 |
| 15 |
if (foo (__INT_MAX__ + 1LL)) |
| 16 |
__builtin_abort (); |
| 17 |
if (!foo (__INT_MAX__ + 2LL)) |
| 18 |
__builtin_abort (); |
| 19 |
if (foo (-__INT_MAX__ - 1LL)) |
| 20 |
__builtin_abort (); |
| 21 |
if (!foo (-__INT_MAX__ - 2LL)) |
| 22 |
__builtin_abort (); |
| 23 |
#endif |
| 24 |
} |