[Bug target/17565] New: asms in delay slots
rsandifo at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Sep 20 06:43:00 GMT 2004
The MIPS port allows asms to be put into delay slots if the
compiler guesses they are only one instruction long. This is
wrong because of the possibiltiy of it containing macros.
The problem can be reproduced as an assembler warning
in the following testcase:
int foo (int n)
{
register int k asm ("$16") = n;
if (k > 0)
{
bar ();
asm ("li %0,0x12345678" : "=r" (k));
}
return k;
}
because the multi-instruction asm statement goes into the delay
slot of the call to bar().
This is reduced from a much more serious linux problem.
Linux is fond of using empty asm statements, and since gcc estimates
empty asms to be one instruction long, they too might be put into
delay slots. This actually has the effect of putting the following
instruction into the delay slot instead. Since there's no assembler
warning, the problem was only detected as a run-time failure.
This problem goes back to at least 2.95.
Richard
--
Summary: asms in delay slots
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rsandifo at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: mips64-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17565
More information about the Gcc-bugs
mailing list