store motion breaks asm outputs to memory
Alexandre Oliva
aoliva@redhat.com
Sat Apr 14 08:29:00 GMT 2001
The following program:
int *p;
int f () {
int ret;
asm volatile ("%0" : "=m" (ret));
if (ret != 0)
*p = ret;
return ret;
}
fails to compile with -mam33 -O2 on mn10300-elf. The problem is that
the careful addressof expansion of the asm output operand, that would
have allowed it to compile, is annihilated by store motion: it
replaces with a pseudo the dest stack slot ``copied from'' the
ASM_OPERANDS. The pseudo ends up being assigned to d0 by global
alloc, and reload barfs, complaining of inconsistent operand
constraints in the asm.
Here's a fix. The first hunk is enough to fix the problem, but I
couldn't convince myself the second shouldn't remain. Ok to install?
More information about the Gcc-patches
mailing list