In this code:
static void *bof;
int foo()
{
__label__ boo;
boo: bar();
bof = &&boo;
}
the label "boo" is emitted as .L2, but it is being placed before the function
prologue:
foo:
.L2:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
call bar
movl $.L2, bof
leave
ret
If I add a goto to the label, it is placed correctly:
static void *bof;
int foo()
{
__label__ boo;
boo: bar();
bof = &&boo;
goto boo;
}
foo:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
.L3:
call bar
movl $.L3, bof
jmp .L3
--
Summary: local label-as-value being placed before function prolog
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jeremy at goop dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29305