Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/shift-6.c

raw
1 /* PR sanitizer/58413 */
2 /* { dg-do run { target int32plus } } */
3 /* { dg-options "-fsanitize=shift -w -fno-sanitize-recover=shift" } */
4
5 int x = 7;
6 int
7 main (void)
8 {
9 /* All of the following should pass. */
10 int A[128 >> 5] = {};
11 int B[128 << 5] = {};
12
13 static int e =
14 ((int)
15 (0x00000000 | ((31 & ((1 << (4)) - 1)) << (((15) + 6) + 4)) |
16 ((0) << ((15) + 6)) | ((0) << (15))));
17
18 if (e != 503316480)
19 __builtin_abort ();
20
21 switch (x)
22 {
23 case 1 >> 4:
24 case 1 << 4:
25 case 128 << (4 + 1):
26 case 128 >> (4 + 1):
27 return 1;
28 }
29 return 0;
30 }