Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/pr109107-4.c

raw
1 /* PR sanitizer/109107 */
2 /* { dg-do run { target int32 } } */
3 /* { dg-options "-fsanitize=signed-integer-overflow" } */
4
5 #define INT_MIN (-__INT_MAX__ - 1)
6 const int x = INT_MIN;
7 const int y = -2;
8 int a = -3;
9
10 __attribute__((noipa)) int
11 foo ()
12 {
13 int c = x - (y - a);
14 return c;
15 }
16
17 int
18 main ()
19 {
20 foo ();
21 return 0;
22 }
23
24 /* { dg-output "signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'" } */