https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98896
Bug ID: 98896
Summary: local label displaced with -O2
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: stsp at users dot sourceforge.net
Target Milestone: ---
The following code works as expected with
clang, but hangs with gcc with -O2 (works with -O1):
---
int main()
{
__label__ ret;
asm volatile ("jmp *%0\n" :: "r"(&&ret) : "memory");
ret:
return 0;
}
---
As can be seen from a disasm, the label is put before asm block.