aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstrict-overflow-11.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-overflow-11.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c b/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
new file mode 100644
index 0000000..c98610e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=1" } */
+
+/* Based on strict-overflow-5.c. */
+
+/* We can only unroll when using strict overflow semantics. */
+
+int foo (int i)
+{
+ int index;
+ int r=0;
+
+ for (index = i; index <= i+4; index+=2) /* { dg-warning "assuming signed overflow does not occur" "correct warning" } */
+ r++;
+
+ return r;
+}