[Bug inline-asm/32811] Cannot flag inline assembler code "noreturn"

gcc at kalvdans dot no-ip.org gcc-bugzilla@gcc.gnu.org
Tue Jul 19 13:00:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32811

Christian Häggström <gcc at kalvdans dot no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at kalvdans dot
                   |                            |no-ip.org

--- Comment #3 from Christian Häggström <gcc at kalvdans dot no-ip.org> 2011-07-19 12:59:43 UTC ---
It works by adding __builtin_unreachable() as suggested by the documentation
for asm goto.

$ cat pr32811.c

__attribute__ ((noreturn)) void noreturn_via_asm_goto() {
 loop:
  asm goto ("jmp %l[loop]\n" : : : : loop);
  __builtin_unreachable();
}

$ gcc -O2 -Wall pr32811.c -c && objdump -d pr32811.o

pr32811.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <noreturn_via_asm_goto>:
   0:   eb fe                   jmp    0 <noreturn_via_asm_goto>

So I think this bug can be closed.



More information about the Gcc-bugs mailing list