The following code breaks when compiled with -O3 or -O2, because the label seems to be misplaced. This problem seems to be restricted to situations where I pass the address of a label into an assembly routine to be used. When compiled without optimizations or with -O1, it works properly. I´m compiling in FreeBSD 5.3-RELEASE gcc version 3.4.3, and I have confirmed that it occurs also on Knoppix 3.6 with compiler version 3.3.4. No flags other than aforementioned optimization flags were used in any case. I hope this is enough info. main() { puts("This line should print.\n"); asm("jmpl *%0\n":: "q" (&&foo)); puts("This line should not print"); foo: puts("And this line should print.\n"); }
-- Summary: Labels broken when passed into inline assembly. Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: estith at cs dot und dot edu CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: 3.4.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19969