| 1 |
/* PR tree-optimization/106990 */ |
| 2 |
/* { dg-do run { target int32 } } */ |
| 3 |
/* { dg-options "-fsanitize=signed-integer-overflow" } */ |
| 4 |
|
| 5 |
__attribute__((noipa)) int |
| 6 |
foo (void) |
| 7 |
{ |
| 8 |
int x = -1956816001; |
| 9 |
int y = 1999200512; |
| 10 |
return ~x - ~y; |
| 11 |
} |
| 12 |
|
| 13 |
__attribute__((noipa)) int |
| 14 |
bar (void) |
| 15 |
{ |
| 16 |
int x = -__INT_MAX__ - 1; |
| 17 |
return -x & 1; |
| 18 |
} |
| 19 |
|
| 20 |
int |
| 21 |
main () |
| 22 |
{ |
| 23 |
foo (); |
| 24 |
bar (); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
/* { dg-output "signed integer overflow: 1956816000 - -1999200513 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ |
| 29 |
/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself" } */ |