| /* PR sanitizer/109107 */ | |
| /* { dg-do run { target int32 } } */ | |
| /* { dg-options "-fsanitize=signed-integer-overflow" } */ | |
| #define INT_MIN (-__INT_MAX__ - 1) | |
| const int x = INT_MIN; | |
| const int y = -2; | |
| int a = -3; | |
| __attribute__((noipa)) int | |
| foo () | |
| { | |
| int c = x - (y - a); | |
| return c; | |
| } | |
| int | |
| main () | |
| { | |
| foo (); | |
| return 0; | |
| } | |
| /* { dg-output "signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'" } */ |