This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Testsuite fix


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];
  }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]