summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr46675.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr46675.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr46675.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr46675.c b/gcc/testsuite/gcc.dg/pr46675.c
new file mode 100644
index 000000000..7493f0e60
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr46675.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+int j;
+
+void
+__attribute__((noinline))
+foo (int n)
+{
+ int npairs, i;
+ npairs = n - (-__INT_MAX__ - 1);
+
+ if (npairs > 0)
+ for (i = 0; i < npairs; i++)
+ j++;
+}
+
+int
+main ()
+{
+ foo (5 - __INT_MAX__ - 1);
+
+ if (j != 5)
+ abort ();
+
+ return 0;
+}