aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c
new file mode 100644
index 000000000..9eecf94e2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-fab1" } */
+
+/* Check that we fold strlen of equally long strings, and that we do not
+ fail to terminate when there is a nontrivial cycle in the corresponding
+ ssa graph. */
+
+extern __SIZE_TYPE__ strlen (const char *);
+
+void foo(int i)
+{
+ char *s = "abcde";
+
+ if (i)
+ {
+ s = "defgh";
+ goto middle;
+ }
+
+start:
+
+ bla ();
+
+middle:
+
+ if (bla ())
+ goto start;
+
+ bar (strlen (s));
+}
+
+/* There should be no calls to strlen. */
+/* { dg-final { scan-tree-dump-times "strlen" 0 "fab1"} } */
+/* { dg-final { cleanup-tree-dump "fab1" } } */