comparison gcc/testsuite/g++.dg/ubsan/cxx11-shift-2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* { dg-do run } */ 1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=shift -w -std=c++11" } */ 2 /* { dg-options "-fsanitize=shift -w -std=c++11" } */
3 3
4 int 4 int
5 main (void) 5 main ()
6 { 6 {
7 int a = -42; 7 int a = -42;
8 a <<= 1; 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);
9 } 15 }
10 /* { dg-output "left shift of negative value -42" } */ 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'" } */