This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21964] New: broken tail call at -O2 or more
- From: "ben at 0x539 dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jun 2005 17:11:12 -0000
- Subject: [Bug c/21964] New: broken tail call at -O2 or more
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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