I have this piece of code:
__asm__(
"someasm" :
:
"i" (&&a),
"i" (&&b));
a:
printf("Hello World!\n");
b:
_PREVENTCOMPILERERROR();
static inline void _PREVENTCOMPILERERROR() {
/*nothing*/;
}
However it generates wrong assembler code:
.L3:
.L2:
#NO_APP
leaq .LC1(%rip), %rdi
call [EMAIL PROTECTED]
Where L3 is the b label and L2 is a.
The problem is in the _PREVENTCOMPILERERROR, if replaced with a
int _PREVENTCOMPILERERRORint
__asm__(
"asm" :
:
"i" (&&a),
"i" (&&b));
a:
printf("Hello World!\n");
b:
_PREVENTCOMPILERERRORint;
I get a compiler warning for being stupid, but the assembler generated is fine:
.L2:
#NO_APP
leaq .LC1(%rip), %rdi
call [EMAIL PROTECTED]
.L3:
--
Summary: Labels are not handled correctly
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: davh at davh dot dk
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34634