test for new tail recursion eliminaton
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 4 Mar 2008 11:12:56 +0000 (11:12 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 4 Mar 2008 11:12:56 +0000 (11:12 +0000)
[r17953]

ir/be/test/tailrec2.c [new file with mode: 0644]

diff --git a/ir/be/test/tailrec2.c b/ir/be/test/tailrec2.c
new file mode 100644 (file)
index 0000000..e2c4d3c
--- /dev/null
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+unsigned fak(unsigned n) {
+       if (n == 0)
+               return 1;
+       return fak(n-1) * n;
+}
+
+int main(int argc, char *argv[]) {
+       unsigned v = 7;
+
+       if (argc > 1)
+               v = atoi(argv[1]);
+       printf("%u! = %u\n", v, fak(v));
+}