2018-06-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr68412.c
blob825eb63073010526a5ffc9fc134324383e6e2148
1 /* PR c/68412 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wall -Wextra" } */
5 #define M (sizeof (int) * __CHAR_BIT__)
7 int
8 fn1 (int i)
10 return i == (-1 << 8); /* { dg-warning "left shift of negative value" } */
13 int
14 fn2 (int i)
16 return i == (1 << M); /* { dg-warning "left shift count" } */
19 int
20 fn3 (int i)
22 return i == 10 << (M - 1); /* { dg-warning "requires" } */
25 int
26 fn4 (int i)
28 return i == 1 << -1; /* { dg-warning "left shift count" } */
31 int
32 fn5 (int i)
34 return i == 1 >> M; /* { dg-warning "right shift count" } */
37 int
38 fn6 (int i)
40 return i == 1 >> -1; /* { dg-warning "right shift count" } */