The following program: void f(void) { void p(void) { __label__ l1; void q(void) { goto l1; }
l1:; } p(); } int main (void) { f(); return 0; } compiled using the following command line: ../gcc-lin/gcc/xgcc -B../gcc-lin/gcc/ c_jump2.c gives me: /tmp/ccSrSccf.o: In function `q.1137': /tmp/ccSrSccf.o(.text+0x2d): undefined reference to `.L7' collect2: ld returned 1 exit status Output of ../gcc-lin/gcc/xgcc -B../gcc-lin/gcc/ -v: Reading specs from ../gcc-lin/gcc/specs Target: i686-pc-linux-gnu Configured with: ../gcc-4.0.0/configure --enable-languages=c Thread model: posix gcc version 4.0.0 The program works when I use `-O2' or `-O3' option (apparently it works in unit at a time mode and does not work in function at a time mode). The problem affects GNU Pascal, I found the above C program trying to find out why I get the above error from Pascal programs. -- Summary: Nonlocal gotos between nested functions cause undefined labels in assembler output Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hebisch at math dot uni dot wroc dot pl CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21728