Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/pr81281.C

raw
1 // PR sanitizer/81281
2 // { dg-do run }
3 // { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" }
4 // { dg-additional-sources "pr81281-aux.cc" }
5
6 extern const int ci;
7 extern int i;
8 extern long long ll;
9
10 int
11 foo ()
12 {
13 int a = (int) (-2024172551 - i - (ci - ll))
14 - ((int) (-2024172551 - i - (ci - ll))
15 - (int) (-2024172551 - (long long)ci));
16 return a;
17 }
18
19 int
20 main ()
21 {
22 if (__SIZEOF_INT__ * __CHAR_BIT__ == 32
23 && __SIZEOF_LONG_LONG__ * __CHAR_BIT__ == 64)
24 foo ();
25 return 0;
26 }