[Bug inline-asm/11563] New: ia64 gcc won't save b0 when inline asm clobbers it
rcbilson at plg dot uwaterloo dot ca
gcc-bugzilla@gcc.gnu.org
Thu Jul 17 18:20:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11563
Summary: ia64 gcc won't save b0 when inline asm clobbers it
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rcbilson at plg dot uwaterloo dot ca
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: ia64-linux
GCC host triplet: ia64-linux
GCC target triplet: ia64-linux
Consider the following program:
void f() {}
void
g()
{
asm( "br.call.sptk b0 = f" : : : "b0" );
}
When compiled with gcc -S, the function g is output as follows:
.global g#
.proc g#
g:
.prologue 2, 2
.vframe r2
mov r2 = r12
.body
#APP
br.call.sptk b0 = f
#NO_APP
;;
.restore sp
mov r12 = r2
br.ret.sptk.many b0
;;
.endp g#
.ident "GCC: (GNU) 3.3.1 20030626 (Debian prerelease)"
As was stated in the "clobbers" section of the asm, the br.call.sptk instruction
overwrites b0. However, the generated code makes no attempt to save b0 before
the asm; after returning from f, it uses the clobbered value as the address to
return to via br.ret.
If the function g is modified to make an ordinary C function call the problem
goes away, as gcc does properly save and restore b0 around C function calls.
More information about the Gcc-bugs
mailing list