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]

Patch for various signed/unsigned warnings


This patch fixes these signed/unsigned warnings:
 > df.c:305: warning: comparison between signed and unsigned
 > optabs.c:1249: warning: comparison between signed and unsigned
 > optabs.c:1264: warning: comparison between signed and unsigned
 > optabs.c:1285: warning: comparison between signed and unsigned
 > simplify-rtx.c:2311: warning: signed and unsigned type in conditional expression
 > unroll.c:347: warning: comparison between signed and unsigned
 > unroll.c:347: warning: comparison between signed and unsigned
 > unroll.c:377: warning: comparison between signed and unsigned


Bootstrapped on sparc-sun-solaris2.7, ok to install?

		Thanks,
		--Kaveh


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

	* df.c (df_insn_table_realloc): Change parameter to unsigned.
	* optabs.c (expand_binop): Make variable unsigned.
	* simplify-rtx.c (simplify_subreg): Likewise.
	* unroll.c (unroll_loop): Cast to avoid signed/unsigned warnings.
	
diff -rup orig/egcc-CVS20020730/gcc/df.c egcc-CVS20020730/gcc/df.c
--- orig/egcc-CVS20020730/gcc/df.c	2002-07-23 16:00:14.000000000 -0400
+++ egcc-CVS20020730/gcc/df.c	2002-07-31 14:29:58.750669429 -0400
@@ -182,7 +182,7 @@ static void df_reg_table_realloc PARAMS(
 #if 0
 static void df_def_table_realloc PARAMS((struct df *, int));
 #endif
-static void df_insn_table_realloc PARAMS((struct df *, int));
+static void df_insn_table_realloc PARAMS((struct df *, unsigned int));
 static void df_bitmaps_alloc PARAMS((struct df *, int));
 static void df_bitmaps_free PARAMS((struct df *, int));
 static void df_free PARAMS((struct df *));
@@ -299,7 +299,7 @@ static inline bool read_modify_subreg_p 
 static void
 df_insn_table_realloc (df, size)
      struct df *df;
-     int size;
+     unsigned int size;
 {
   size++;
   if (size <= df->insn_size)
diff -rup orig/egcc-CVS20020730/gcc/optabs.c egcc-CVS20020730/gcc/optabs.c
--- orig/egcc-CVS20020730/gcc/optabs.c	2002-07-22 11:10:53.000000000 -0400
+++ egcc-CVS20020730/gcc/optabs.c	2002-07-31 14:47:33.441417903 -0400
@@ -1219,7 +1219,7 @@ expand_binop (mode, binoptab, op0, op1, 
     {
       unsigned int i;
       optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
-      int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
+      const unsigned int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
       rtx carry_in = NULL_RTX, carry_out = NULL_RTX;
       rtx xop0, xop1, xtarget;
 
diff -rup orig/egcc-CVS20020730/gcc/simplify-rtx.c egcc-CVS20020730/gcc/simplify-rtx.c
--- orig/egcc-CVS20020730/gcc/simplify-rtx.c	2002-07-27 22:16:15.000000000 -0400
+++ egcc-CVS20020730/gcc/simplify-rtx.c	2002-07-31 14:39:32.366078687 -0400
@@ -2280,7 +2280,7 @@ simplify_subreg (outermode, op, innermod
   if (GET_CODE (op) == CONST_VECTOR)
     {
       int elt_size = GET_MODE_SIZE (GET_MODE_INNER (innermode));
-      int offset = byte / elt_size;
+      const unsigned int offset = byte / elt_size;
       rtx elt;
 
       if (GET_MODE_INNER (innermode) == outermode)
diff -rup orig/egcc-CVS20020730/gcc/unroll.c egcc-CVS20020730/gcc/unroll.c
--- orig/egcc-CVS20020730/gcc/unroll.c	2002-07-30 16:00:12.000000000 -0400
+++ egcc-CVS20020730/gcc/unroll.c	2002-07-31 14:44:51.898604213 -0400
@@ -343,8 +343,8 @@ unroll_loop (loop, insn_count, strength_
     }
   else if (loop_info->n_iterations > 0
 	   /* Avoid overflow in the next expression.  */
-	   && loop_info->n_iterations < MAX_UNROLLED_INSNS
-	   && loop_info->n_iterations * insn_count < MAX_UNROLLED_INSNS)
+	   && loop_info->n_iterations < (unsigned) MAX_UNROLLED_INSNS
+	   && loop_info->n_iterations * insn_count < (unsigned) MAX_UNROLLED_INSNS)
     {
       unroll_number = loop_info->n_iterations;
       unroll_type = UNROLL_COMPLETELY;
@@ -374,7 +374,7 @@ unroll_loop (loop, insn_count, strength_
       for (i = 3; i >= 0; i--)
 	while (factors[i].count--)
 	  {
-	    if (temp * factors[i].factor < MAX_UNROLLED_INSNS)
+	    if (temp * factors[i].factor < (unsigned) MAX_UNROLLED_INSNS)
 	      {
 		unroll_number *= factors[i].factor;
 		temp *= factors[i].factor;


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