summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c
new file mode 100644
index 00000000000..a114379a7ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c
@@ -0,0 +1,30 @@
+/* PR optimization/12640
+
+ We used to get into an infinite loop while trying to
+ figure out `strlen (resultString)'. This showed up as
+ a stack overflow while compiling tk. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int i;
+
+static void
+SendEventProc (char *resultString)
+{
+ char *p;
+
+ resultString = "";
+ while (*p == '-')
+ {
+ if (p[2] == ' ')
+ {
+ resultString = p + 3;
+ }
+ }
+ for (;;)
+ {
+ i = strlen (resultString) + 1;
+ }
+}
+