The following code compiled with just -O0 generates bad assembler with undefined label: int x(int a, int b) { __label__ xlab; __label__ xlab2; void y(int b) { switch (b) { case 1: goto xlab; case 2: goto xlab; } } a = a + 2; y (b); xlab:; return a; xlab2:; a++; return a; } main (int ac) { int i; if ((i=x (1, ac), printf("%d\n",i), i) != 2 + ac) abort (); exit (0); } The assembler failure looks like: Undefined first referenced symbol in file .LL9 /var/tmp//ccLPhTcj.o ld: fatal: Symbol referencing errors. No output written to a.out The t04.nested tree already looks bad: ---------------------------------- y (b) { voidD.28 *[3] * D.1136; voidD.28 *[3] * D.1138; switch (bD.1124) { case 1: goto <D1127>; case 2: goto <D1128>; default : goto <D1131>; } <D1127>:; D.1136 = &CHAIN.1D.1135->__nl_goto_bufD.1133; __builtin_nonlocal_goto (&<D1132>, D.1136); <D1128>:; D.1138 = &CHAIN.1D.1135->__nl_goto_bufD.1133; __builtin_nonlocal_goto (&<D1137>, D.1138); <D1131>:; } x (a, b) { struct FRAME.x FRAME.0D.1134; intD.0 D.1129; voidD.28 xlabD.1122 = <<< error >>>; voidD.28 xlab2D.1123 = <<< error >>>; static voidD.28 yD.1125 (intD.0); aD.1118 = aD.1118 + 2; y (bD.1119) [static-chain: &FRAME.0D.1134]; goto xlabD.1122; <D1137>: [non-local]; xlabD.1122:; D.1129 = aD.1118; return D.1129; xlab2D.1123:; aD.1118 = aD.1118 + 1; D.1129 = aD.1118; return D.1129; } ---------------------------------- The line with problems: __builtin_nonlocal_goto (&<D1132>, D.1136); The reference to &<D1132> is a reference to non-existent label. This problem can be reproduced on all 4.0.* versions and 4.1-20050924 as well. The versions 3.x are ok. I think all hardware platforms may be affected. Alex.
Confirmed. We already go wrong in .nested.
A regression hunt for powerpc-linux on mainline identified the merge of the tree-ssa branch.
Subject: Bug 24135 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-10-03 20:57:45 Modified files: gcc : ChangeLog tree-nested.c Added files: gcc/testsuite/gcc.c-torture/execute: pr24135.c Log message: PR 24135 * tree-nested.c (convert_nl_goto_reference): Lookup a translation before creating a new one. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10070&r2=2.10071 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-nested.c.diff?cvsroot=gcc&r1=2.31&r2=2.32 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr24135.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 24135 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: rth@gcc.gnu.org 2005-10-03 22:01:55 Modified files: gcc : ChangeLog tree-nested.c Added files: gcc/testsuite/gcc.c-torture/execute: pr24135.c Log message: PR 24135 * tree-nested.c (convert_nl_goto_reference): Lookup a translation before creating a new one. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.441&r2=2.7592.2.442 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-nested.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.24.10.1&r2=2.24.10.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr24135.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed.