[Bug c/21964] New: broken tail call at -O2 or more
ben at 0x539 dot de
gcc-bugzilla@gcc.gnu.org
Wed Jun 8 17:11:00 GMT 2005
Optimisations seem to cause the post increment in the recursive function call to
foo() to pass the increased value to the function.
Expected output, and output when compiled without -O2:
0
0
0
0
...
Actual output with -O2 or -O3 or...:
0
1
2
3
...
#include <stdio.h>
void foo(int n);
int main(void) {
foo(0);
return 0;
}
void foo(int n) {
printf("%d\n", n);
foo(n++);
}
--
Summary: broken tail call at -O2 or more
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ben at 0x539 dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21964
More information about the Gcc-bugs
mailing list