Patch to fix 'comparison is always false' warning in f/where.c

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Aug 20 13:33:00 GMT 2002


The patch below fixes this warning:

 > f/where.c:439: warning: comparison is always false due to limited range of data type

The variable `cn' is an unsigned char, and FFEWHERE_indexUNKNOWN is
UCHAR_MAX.  So the comparison is indeed always false.  I removed the
`then' clause of the if-stmt and left in the `else' clause.

Bootstrapped on sparc-sun-solaris2.7 --disable-checking --disable-nls
--enable-languages=c,f77, there were no fortran regressions.  

Ok to install?

		Thanks,
		--Kaveh


2002-08-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* where.c (ffewhere_track): Remove impossible if-then clause.

diff -rup orig/egcc-CVS20020819/gcc/f/where.c egcc-CVS20020819/gcc/f/where.c
--- orig/egcc-CVS20020819/gcc/f/where.c	2002-06-04 07:03:47.000000000 -0400
+++ egcc-CVS20020819/gcc/f/where.c	2002-08-20 11:55:36.012879618 -0400
@@ -436,22 +436,11 @@ ffewhere_track (ffewhereLine *wl, ffewhe
   else
     {
       wt[i * 2 - 2] = lo;
-      if (cn > FFEWHERE_indexUNKNOWN)
-	{
-	  wt[i * 2 - 1] = FFEWHERE_indexUNKNOWN;
-	  ffewhere_line_kill (*wl);
-	  ffewhere_column_kill (*wc);
-	  *wl = ffewhere_line_unknown ();
-	  *wc = ffewhere_column_unknown ();
-	}
-      else
-	{
-	  wt[i * 2 - 1] = cn - 1;
-	  ffewhere_line_kill (*wl);
-	  ffewhere_column_kill (*wc);
-	  *wl = ffewhere_line_use (ffewhere_line_new (ln));
-	  *wc = ffewhere_column_use (ffewhere_column_new (cn));
-	}
+      wt[i * 2 - 1] = cn - 1;
+      ffewhere_line_kill (*wl);
+      ffewhere_column_kill (*wc);
+      *wl = ffewhere_line_use (ffewhere_line_new (ln));
+      *wc = ffewhere_column_use (ffewhere_column_new (cn));
     }
 }
 



More information about the Gcc-patches mailing list