This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Testsuite fix
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Jun 2003 18:11:40 -0600
- Subject: [tree-ssa] Testsuite fix
- Reply-to: law at redhat dot com
The combination of dead code elimination and removal of unused variables
was causing this test to fail (gcc.dg/noncompile/920507-1.c)
void
x(void)
{
register int *a asm("unknown_register"); /* { dg-error "invalid register"
}*/
int *v[1] = {a};
}
Basically DCE eliminated all the executable statements since they contributed
nothing to result of the program. Then the unused variable eliminator
removed "a" thus avoiding the expected error message.
Fix is simple -- just make sure the function returns a value...
* gcc.dg/noncompile/920507-1.c: Return a value so that the
variable "a" is always used.
Index: 920507-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/noncompile/920507-1.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 920507-1.c
*** 920507-1.c 7 Feb 2002 09:08:24 -0000 1.2
--- 920507-1.c 26 Jun 2003 00:10:19 -0000
***************
*** 1,6 ****
! void
x(void)
{
register int *a asm("unknown_register"); /* { dg-error "invalid register"
} */
int *v[1] = {a};
}
--- 1,7 ----
! int *
x(void)
{
register int *a asm("unknown_register"); /* { dg-error "invalid register"
} */
int *v[1] = {a};
+ return v[1];
}