The following test program will
print "OK" if compiled without -g3
(-g1, -g2 are fine), and Segfaults
with -g3.
---
#include <stdio.h>
asm (
"__tst:\n"
"movl $1, %eax\n"
"ret\n");
int tst(void) asm ("__tst");
int main()
{
if (tst() == 1)
printf("OK\n");
else
printf("Segmentation fault\n");
return 0;
}
---
With -g3, tst() will call to the wrong
address.
gcc version 4.1.2 20070925 (Red Hat 4.1.2-27)
--
Summary: miscalculation of asm labels with -g3
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stsp at users dot sourceforge dot net
GCC host triplet: x86_64, i386
GCC target triplet: x86_64, i386
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33932