Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/cxx11-shift-2.C

raw
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=shift -w -std=c++11" } */
3
4 int
5 main ()
6 {
7 int a = -42;
8 a <<= 1;
9 a = -43;
10 a <<= 0;
11 a = -44;
12 a <<= (__SIZEOF_INT__ * __CHAR_BIT__ - 1);
13 a = 32;
14 a <<= (__SIZEOF_INT__ * __CHAR_BIT__ - 3);
15 }
16 /* { dg-output "left shift of negative value -42.*" } */
17 /* { dg-output "left shift of negative value -43.*" } */
18 /* { dg-output "left shift of negative value -44.*" } */
19 /* { dg-output "left shift of 32 by \[0-9]* places cannot be represented in type 'int'" } */