https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99508
Bug ID: 99508 Summary: Asm labels declared inside a function are ignored Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: frank.mehnert at googlemail dot com Target Milestone: --- This is apparently a gcc-11 regression. Following example: #include <cstdio> void foo() { void bar() asm ("bar_assembler"); extern unsigned buzz asm("buzz_assembler"); bar(); printf("%d\n", buzz); } Compile this C++ source code with -c and look at the generated symbols with 'objdump -tC'. g++-10: 0000000000000000 *UND* 0000000000000000 bar_assembler 0000000000000000 *UND* 0000000000000000 buzz_assembler 0000000000000000 *UND* 0000000000000000 printf g++-11: (Debian experimental 20210306): 0000000000000000 *UND* 0000000000000000 bar() 0000000000000000 *UND* 0000000000000000 buzz 0000000000000000 *UND* 0000000000000000 printf g++11 produces the same result as g++10 if 'bar' and 'buzz' are declared outside foo().