Debian Codegraph @

gcc/testsuite/gcc.dg/ubsan/c99-shift-5.c

raw
1 /* { dg-do run } */
2 /* { dg-shouldfail "ubsan" } */
3 /* { dg-options "-fsanitize=shift -fsanitize-recover=shift-base -fno-sanitize-recover=shift-exponent -w -std=c99" } */
4
5 int
6 main (void)
7 {
8 int a = -42;
9 int b = -43;
10 volatile int c = 129;
11 int d = 1;
12 a << 1;
13 a << 1;
14 d <<= 31;
15 b << c;
16 a << 1;
17 }
18 /* { dg-output "left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */
19 /* { dg-output "\[^\n\r]*left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */
20 /* { dg-output "\[^\n\r]*left shift of 1 by 31 places cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
21 /* { dg-output "\[^\n\r]*shift exponent 129 is too large for \[^\n\r]*-bit type 'int'" } */