1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=signed-integer-overflow" } */
3
4 #define INT_MIN (-__INT_MAX__ - 1)
5
6 int
main()7 main ()
8 {
9 int x = INT_MIN;
10 int y;
11 asm ("" : "+g" (x));
12 y = -(-x);
13 asm ("" : "+g" (y));
14 y = -(-INT_MIN);
15 asm ("" : "+g" (y));
16 }
17
18 /* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
19 /* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
20 /* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
21 /* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself" } */
22