bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Add -ldl.
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / shift-1.c
blob0928ff7a1027b245c46584d7f03edee708d0b3ef
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=shift -w" } */
4 typedef const unsigned long long int CULLI;
5 typedef volatile int VI;
6 struct s { signed long int a; };
8 int
9 main (void)
11 int a = 1;
12 struct s s = { .a = 400 };
13 CULLI culli = 42;
14 VI vi = 370;
15 volatile int shiftcount = 153;
17 a <<= 152;
18 1 << shiftcount;
19 1 << 154;
20 culli << 524;
21 1 << vi++;
22 (long) 1 << (s.a + 2);
24 return 0;
26 /* { dg-output "shift exponent 152 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
27 /* { dg-output "\[^\n\r]*shift exponent 153 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
28 /* { dg-output "\[^\n\r]*shift exponent 154 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
29 /* { dg-output "\[^\n\r]*shift exponent 524 is too large for \[^\n\r]*-bit type 'long long unsigned int'(\n|\r\n|\r)" } */
30 /* { dg-output "\[^\n\r]*shift exponent 370 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
31 /* { dg-output "\[^\n\r]*shift exponent 402 is too large for \[^\n\r]*-bit type 'long int'(\n|\r\n|\r)" } */