The problem here is that if the inline-asm constraint allows memory
and we have an INDIRECT_REF, we don't check if the register of that
variable is the clobber list. We ICE because later on, we see that
the register is in the clobber and in an output register of the
inline-asm. The way to fix is to skip passed the INDIRECT_REF
when checking if the variable is a global register and is in the
clobber list.
OK? Bootstrapped and tested on powerpc-darwin with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* stmt.c (expand_asm_operands): Skip passed INDIRECT_REF if the
constraint allows memory right before checking against the
conflicts.
Patch:
fix.diff.txt
Description: Text document
Testcase:
/* { dg-do compile { target alpha-*-* cris-*-* i?86-*-* mmix-*-*
powerpc*-*-* rs6000-*-* x86_64-*-* } } */
/* { dg-options "-O2" } */
/* Making sure that asm clobbers conflicting with asm-declared output
operands are detected with memory operands. */
#if defined (__alpha__)
# define REG "$1"
#elif defined (__CRIS__)
# define REG "r10"
#elif defined (__i386__)
# define REG "%eax"
#elif defined (__MMIX__)
# define REG "$8"
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
|| defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
# define REG "6"
#elif defined (__x86_64__)
# define REG "rax"
#endif
void bug(void)
{
register char* dst __asm (REG);
__asm__ ("%0":"=g"(*dst): : REG); /* { dg-error "conflict" } */
}
|