aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c
new file mode 100644
index 000000000..ae96ba39f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr30364-3.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fwrapv" } */
+
+#include <limits.h>
+extern void abort (void);
+
+int f(int a, int b)
+{
+ if (a > INT_MAX - 15) return 0;
+ if (b > INT_MAX - 15) return 0;
+
+ int c = (a - 20) + (b - 20);
+ return c > INT_MAX - 15;
+}
+
+int main()
+{
+ if (f (INT_MAX - 15, 41) != 1)
+ abort ();
+ return 0;
+}