summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wshift-overflow-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wshift-overflow-5.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wshift-overflow-5.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wshift-overflow-5.c b/gcc/testsuite/c-c++-common/Wshift-overflow-5.c
new file mode 100644
index 0000000000..c9f464355d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wshift-overflow-5.c
@@ -0,0 +1,11 @@
+/* PR c++/55095 */
+/* { dg-do compile { target int32 } } */
+/* { dg-options "-O -Wshift-overflow=2" } */
+/* { dg-additional-options "-std=c++11" { target c++ } } */
+
+#define INTM1 (sizeof (int) * __CHAR_BIT__ - 1)
+#define LLONGM1 (sizeof (long long) * __CHAR_BIT__ - 1)
+
+int i1 = 1 << INTM1; /* { dg-warning "requires 33 bits to represent" } */
+unsigned u1 = 1 << INTM1; /* { dg-warning "requires 33 bits to represent" } */
+long long int l1 = 1LL << LLONGM1; /* { dg-warning "requires 65 bits to represent" } */