http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55749
Bug #: 55749
Summary: gcc 4.7.1 removes labels mistakenly
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
gcc version 4.7.1 (GCC) x86_64-unknown-linux-gnu
in the following small c program, label-as-value always incorrectly uses the
begining of the function (.e. pointer p is always set to the begining of foo).
Turning of scheduling will generate the correct code.
Is this a known bug? any pointer will be appreciated. thanks
>cat m.c
void *p;
extern void bar();
void foo()
{
p = &&my_label;
bar();
my_label:
bar();
}
> gcc -O2 -S m.c
> less m.s
.globl foo
.type foo, @function
foo:
.LFB0:
.L2:
subq $8, %rsp
.LCFI0:
xorl %eax, %eax
movq $.L2, p(%rip)
call bar
xorl %eax, %eax
addq $8, %rsp
.LCFI1:
jmp bar
.LFE0:
.size foo, .-foo
.comm p,8,8
.comm i,4,4