re PR middle-end/18160 (ICE on taking register variable address)

PR middle-end/18160
	* gcc.dg/register-var-1.c: New test.
	* gcc.dg/register-var-2.c: New test.
	* gcc.dg/asm-7.c: Taking the address of a register variable is an
	error now.

From-SVN: r89773
This commit is contained in:
Adam Nemet 2004-10-28 19:31:25 +00:00 committed by Adam Nemet
parent 0039fa5565
commit fcf750eec2
4 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2004-10-28 Adam Nemet <anemet@lnxw.com>
PR middle-end/18160
* gcc.dg/register-var-1.c: New test.
* gcc.dg/register-var-2.c: New test.
* gcc.dg/asm-7.c: Taking the address of a register variable is an
error now.
2004-10-28 Dorit Naishlos <dorit@il.ibm.com>
PR other/18172

View File

@ -9,7 +9,7 @@ void test(void)
static int m;
int *p;
__asm__ ("" : : "m"(r)); /* { dg-warning "address of register" } */
__asm__ ("" : : "m"(r)); /* { dg-error "" } */
__asm__ ("" : : "m"(i));
__asm__ ("" : : "m"(m));
__asm__ ("" : : "m"(0)); /* { dg-error "" } */
@ -22,7 +22,7 @@ void test(void)
__asm__ ("" : : "g"(0));
__asm__ ("" : : "g"(i+1));
__asm__ ("" : "=m"(r2)); /* { dg-warning "address of register" } */
__asm__ ("" : "=m"(r2)); /* { dg-error "" } */
__asm__ ("" : "=m"(i));
__asm__ ("" : "=m"(m));
}

View File

@ -0,0 +1,14 @@
/* PR/18160 */
/* { dg-do compile { target i?86-*-* } } */
/* This should yield an error even without -pedantic. */
/* { dg-options "-ansi" } */
void g(int *);
void f(void)
{
register int x __asm ("eax");
g(&x); /* { dg-error "error: address of register variable" } */
}

View File

@ -0,0 +1,14 @@
/* PR/18160 */
/* { dg-do compile } */
/* This should yield an error even without -pedantic. */
/* { dg-options "-ansi" } */
void g(int *);
void f(void)
{
register int x;
g(&x); /* { dg-error "error: address of register variable" } */
}