Who is responsible for satisfying assembler constraints?
Jan Vroonhof
jan.vroonhof@insignia.com
Tue Jul 11 06:23:00 GMT 2000
[Please CC. I am not subsribed]
I have a question about constraints on inline assembler parameters.
If this is in the docs I missed them (Please feel free to point me
to the right location if so).
Consider the following fragment, which is
adapted from code deeply embedded in a large C file:
void
func (void)
{
unsigned long ourFpuCw;
unsigned long savedFpuCw;
{
__asm__ __volatile__ (
"fstcw %0 \n" "fldcw %1 \n"
: "=o" (savedFpuCw)
: "o" (ourFpuCw)
);
}
}
/*
Local Variables:
compile-command: "gcc -O1 -c -o interp.o ibug.c"
End:
*/
This produces the following output in gcc 2.95.2
ibug.c:12: warning: asm operand 0 probably doesn't match constraints
ibug.c:14: Internal compiler error in `fixup_var_refs_1', at function.c:2071
I reported the crash elsewhere. This question is about the warning.
I can make the warning (and the crash) go away when I make the input and
output variables `volatile'. My hunch is that this forces gcc to put/keep
them in memory instead of a register and thus satisfying the constraints.
However I thought the whole point of constraints was that gcc would make sure
they would be satisfied?
Am I mistaken?
Jan
More information about the Gcc
mailing list