2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / shift-6.c
blobd596459b3eaf0c162e2f9579481b0870cb2587f2
1 /* PR sanitizer/58413 */
2 /* { dg-do run { target int32plus } } */
3 /* { dg-options "-fsanitize=shift -w -fno-sanitize-recover=shift" } */
5 int x = 7;
6 int
7 main (void)
9 /* All of the following should pass. */
10 int A[128 >> 5] = {};
11 int B[128 << 5] = {};
13 static int e =
14 ((int)
15 (0x00000000 | ((31 & ((1 << (4)) - 1)) << (((15) + 6) + 4)) |
16 ((0) << ((15) + 6)) | ((0) << (15))));
18 if (e != 503316480)
19 __builtin_abort ();
21 switch (x)
23 case 1 >> 4:
24 case 1 << 4:
25 case 128 << (4 + 1):
26 case 128 >> (4 + 1):
27 return 1;
29 return 0;