gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-Wshift-count-overflow" } */ |
| 3 | |
| 4 | void foo() |
| 5 | { |
| 6 | unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:left shift count >= width of type" } */ |
| 7 | unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:right shift count >= width of type" } */ |
| 8 | } |