| 1 |
/* PR middle-end/91450 */ |
| 2 |
|
| 3 |
__attribute__((noipa)) void |
| 4 |
foo (int a, int b) |
| 5 |
{ |
| 6 |
unsigned long long r; |
| 7 |
if (__builtin_mul_overflow (a, b, &r)) |
| 8 |
__builtin_abort (); |
| 9 |
if (r != 0) |
| 10 |
__builtin_abort (); |
| 11 |
} |
| 12 |
|
| 13 |
__attribute__((noipa)) void |
| 14 |
bar (int a, int b) |
| 15 |
{ |
| 16 |
unsigned long long r; |
| 17 |
if (a >= 0) |
| 18 |
return; |
| 19 |
if (__builtin_mul_overflow (a, b, &r)) |
| 20 |
__builtin_abort (); |
| 21 |
if (r != 0) |
| 22 |
__builtin_abort (); |
| 23 |
} |
| 24 |
|
| 25 |
__attribute__((noipa)) void |
| 26 |
baz (int a, int b) |
| 27 |
{ |
| 28 |
unsigned long long r; |
| 29 |
if (b >= 0) |
| 30 |
return; |
| 31 |
if (__builtin_mul_overflow (a, b, &r)) |
| 32 |
__builtin_abort (); |
| 33 |
if (r != 0) |
| 34 |
__builtin_abort (); |
| 35 |
} |
| 36 |
|
| 37 |
__attribute__((noipa)) void |
| 38 |
qux (int a, int b) |
| 39 |
{ |
| 40 |
unsigned long long r; |
| 41 |
if (a >= 0) |
| 42 |
return; |
| 43 |
if (b < 0) |
| 44 |
return; |
| 45 |
if (__builtin_mul_overflow (a, b, &r)) |
| 46 |
__builtin_abort (); |
| 47 |
if (r != 0) |
| 48 |
__builtin_abort (); |
| 49 |
} |
| 50 |
|
| 51 |
__attribute__((noipa)) void |
| 52 |
quux (int a, int b) |
| 53 |
{ |
| 54 |
unsigned long long r; |
| 55 |
if (a < 0) |
| 56 |
return; |
| 57 |
if (b >= 0) |
| 58 |
return; |
| 59 |
if (__builtin_mul_overflow (a, b, &r)) |
| 60 |
__builtin_abort (); |
| 61 |
if (r != 0) |
| 62 |
__builtin_abort (); |
| 63 |
} |
| 64 |
|
| 65 |
int |
| 66 |
main () |
| 67 |
{ |
| 68 |
foo (-4, 0); |
| 69 |
foo (0, -4); |
| 70 |
foo (0, 0); |
| 71 |
bar (-4, 0); |
| 72 |
baz (0, -4); |
| 73 |
qux (-4, 0); |
| 74 |
quux (0, -4); |
| 75 |
return 0; |
| 76 |
} |