diff options
author | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
commit | be8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch) | |
tree | 726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/gcc.wendy/gnu12.c |
initial commit
Diffstat (limited to 'gcc/testsuite/gcc.wendy/gnu12.c')
-rwxr-xr-x | gcc/testsuite/gcc.wendy/gnu12.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.wendy/gnu12.c b/gcc/testsuite/gcc.wendy/gnu12.c new file mode 100755 index 0000000..fe31c59 --- /dev/null +++ b/gcc/testsuite/gcc.wendy/gnu12.c @@ -0,0 +1,36 @@ +/* +Deceived: by hoptoad.uucp (1.1/SMI-3.0DEV3) + id AA08037; Wed, 1 Apr 87 03:40:07 PST +Message-Id: <8704010914.AA23555@prep.ai.mit.edu> +Date: 31 Mar 1987 2359-PST (Tuesday) +From: Malcolm Wing <wing@sonoma.stanford.edu> +To: bug-gcc@prep.ai.mit.edu +Subject: Clobber nil bug and Tail recursion bug + +BUG 2 + When compiling Ackerman for the vax it tries to remove the +tail recursion. However the tail recursive call contains another +call so the update (used to be parameter passing) can't be done +until the imbedded call returns. + +SOURCE + +/* Ackerman's function */ +main() +{ + int i; + + i = A(3,6); + if (i == 509) + printf("Test passed\n"); + else + printf("FAILED ackerman's(3, 6): %d\n", i); +} + +A(x,y) +int x,y; +{ + if(x==0) return(++y); + if(y==0) return(A(--x,1)); + return(A(x-1,A(x,--y))); + } |