summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c b/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c
new file mode 100644
index 00000000000..71a4f6716a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-tailr-details" } */
+int
+t(int a)
+{
+ int r;
+ if (a&1)
+ r = t(a-1);
+ else if (a)
+ r = t(a-2);
+ else
+ return 0;
+ if (r)
+ r=r;
+ return r;
+}
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 2 "tailr"} } */