diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c b/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c new file mode 100644 index 0000000..4d29d57 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshift-count-overflow" } */ + +void foo() +{ + unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */ + unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */ +} |