aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstrict-overflow-19.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-overflow-19.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c b/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
new file mode 100644
index 0000000..daf98b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
+
+/* Don't warn about an overflow when threading jumps. We used to get
+ a warning from comparing bounds generated by VRP. */
+
+int
+bar(int a, int b, int n)
+{
+ if (b > a)
+ n = a - b;
+ if (a >= b)
+ n = 1;
+ return n;
+}