comparison gcc/testsuite/c-c++-common/pr48418.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
6 foo (int x) 6 foo (int x)
7 { 7 {
8 const int a = sizeof (int) * __CHAR_BIT__; 8 const int a = sizeof (int) * __CHAR_BIT__;
9 const int b = -7; 9 const int b = -7;
10 int c = 0; 10 int c = 0;
11 c += x << a; /* { dg-warning "left shift count >= width of type" } */ 11 c += x << a; /* { dg-warning "10:left shift count >= width of type" } */
12 c += x << b; /* { dg-warning "left shift count is negative" } */ 12 c += x << b; /* { dg-warning "10:left shift count is negative" } */
13 c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */ 13 c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:left shift count >= width of type" } */
14 c += x << -7; /* { dg-warning "left shift count is negative" } */ 14 c += x << -7; /* { dg-warning "10:left shift count is negative" } */
15 c += x >> a; /* { dg-warning "right shift count >= width of type" } */ 15 c += x >> a; /* { dg-warning "10:right shift count >= width of type" } */
16 c += x >> b; /* { dg-warning "right shift count is negative" } */ 16 c += x >> b; /* { dg-warning "10:right shift count is negative" } */
17 c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */ 17 c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:right shift count >= width of type" } */
18 c += x >> -7; /* { dg-warning "right shift count is negative" } */ 18 c += x >> -7; /* { dg-warning "10:right shift count is negative" } */
19 return c; 19 return c;
20 } 20 }