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]

[testsuite] new test case to test unreachable code option with optimization level 2


Hi,
	
	When following test case was executed with unreachable code option and 
optimization level 2, it unnecessary removes the code.

	Below test case FAILS with gcc-3.4 but with gcc-3.5-20040620 snapshot 
it doesn't give any warning. I am unable to locate the patch which removes 
the warning.

	Please find attached test case for the same. 
	
==========================================================================
testsuite/Changelog

2004-06-30  Nitin Yewale <nitiny@kpitcummins.com>

        * gcc.dg/Wunreachable-8.c : New test


==========================================================================
--- /dev/null	2002-08-31 05:01:37.000000000 +0530
+++ gcc.dg/Wunreachable-8.c	2004-06-30 11:43:39.000000000 +0530
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunreachable-code" } */
+float Factorial(float X)
+{
+	 float val = 1.0;
+	  int k,j;
+	   for (k=1; k < 5; k++)
+		    {
+			      val += 1.0;
+			       }
+	    return (val); /* { dg-bogus "will never be executed" } */
+}
+int main (void)
+{
+	  float result;
+	    result=Factorial(2.1);
+	      return (0);
+}
==========================================================================
Regards,
Nitin Yewale,
KPIT Cummins InfoSystems Ltd.
Pune, India

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH and H8 Series.
The following site also offers free technical support to its users. 
Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on June 1, 2004.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


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