Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/pr60613-1.c

raw
1 /* PR sanitizer/60613 */
2 /* { dg-do run } */
3 /* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */
4
5 long long y;
6
7 __attribute__((noinline, noclone)) long long
8 foo (long long x)
9 {
10 asm ("");
11 if (x >= 0 || x < -2040)
12 return 23;
13 x += 2040;
14 return x - y;
15 }
16
17 __attribute__((noinline, noclone)) long long
18 bar (long long x)
19 {
20 asm ("");
21 return 8LL - x;
22 }
23
24 int
25 main ()
26 {
27 y = 1;
28 if (foo (8 - 2040) != 8 - 1)
29 __builtin_abort ();
30 if (bar (1) != 8 - 1)
31 __builtin_abort ();
32 return 0;
33 }