re PR target/8340 (ICE on x86 inline asm w/ -fPIC)

PR target/8340
	* stmt.c (expand_asm_operands): Produce an error when
	the PIC register is clobbered.

From-SVN: r60313
This commit is contained in:
Eric Botcazou 2002-12-19 18:06:46 +01:00 committed by Eric Botcazou
parent 7f22efe1d6
commit e54b4cae03
4 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
PR target/8340
* stmt.c (expand_asm_operands): Produce an error when
the PIC register is clobbered.
2002-12-18 Daniel Berlin <dberlin@dberlin.org>
* Makefile.in (OBJS): Add alloc-pool.o

View File

@ -1509,7 +1509,16 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
/* Mark clobbered registers. */
if (i >= 0)
SET_HARD_REG_BIT (clobbered_regs, i);
{
/* Clobbering the PIC register is an error */
if ((unsigned) i == PIC_OFFSET_TABLE_REGNUM)
{
error ("PIC register `%s' clobbered in `asm'", regname);
return;
}
SET_HARD_REG_BIT (clobbered_regs, i);
}
}
clear_last_expr ();

View File

@ -1,3 +1,7 @@
2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/i386-pic-1.c: New test.
2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/8099

View File

@ -0,0 +1,18 @@
/* PR target/8340 */
/* { dg-do compile { target i?86-*-* } } */
/* { dg-options "-fPIC" } */
int foo ()
{
static int a;
__asm__ __volatile__ ( /* { dg-error "PIC register" } */
"xorl %%ebx, %%ebx\n"
"movl %%ebx, %0\n"
: "=m" (a)
:
: "%ebx"
);
return a;
}