summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/loop-17.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/loop-17.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-17.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-17.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-17.c
new file mode 100644
index 000000000..d2903cef2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-17.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-sccp-details" } */
+
+/* To determine the number of iterations in this loop we need to fold
+ p_4 + 4B > p_4 + 8B to false. This transformation has caused
+ troubles in the past due to overflow issues. */
+
+int foo (int *p)
+{
+ int i = 0, *x;
+
+ for (x = p; x < p + 2; x++)
+ i++;
+
+ return i;
+}
+
+/* { dg-final { scan-tree-dump "set_nb_iterations_in_loop = 1" "sccp" } } */
+/* { dg-final { cleanup-tree-dump "sccp" } } */