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: fix warnings regression in loop.c


Fixes:
 > loop.c:916: warning: comparison between signed and unsigned

This regressed around 9/4.

I initially fixed a bunch of signed/unsigned warnings in loop.c on
8/15 with casts at each usage of LOOP_REGNO_NREGS.  But in hindsight
that's fragile because one has to remember to put in these casts with
new uses of the macro.  That didn't happen with the 9/4 change so
instead I propose reverting my 8/15 warning cleanup and instead put
the cast inside the macro itself.

Tested on mips-irix6.5 and sparc-sun-solaris2.7.

Ok to install?

		Thanks,
		--Kaveh


2002-10-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* loop.c: Revert 2002-08-15 change.
	(LOOP_REGNO_NREGS): Ensure type is int.
	
diff -rup orig/egcc-CVS20021008/gcc/loop.c egcc-CVS20021008/gcc/loop.c
--- orig/egcc-CVS20021008/gcc/loop.c	2002-10-07 16:00:18.000000000 -0400
+++ egcc-CVS20021008/gcc/loop.c	2002-10-09 10:23:19.617800034 -0400
@@ -151,7 +151,7 @@ Software Foundation, 59 Temple Place - S
 
 #define LOOP_REGNO_NREGS(REGNO, SET_DEST) \
 ((REGNO) < FIRST_PSEUDO_REGISTER \
- ? HARD_REGNO_NREGS ((REGNO), GET_MODE (SET_DEST)) : 1)
+ ? (int) HARD_REGNO_NREGS ((REGNO), GET_MODE (SET_DEST)) : 1)
 
 
 /* Vector mapping INSN_UIDs to luids.
@@ -946,7 +946,7 @@ scan_loop (loop, flags)
 		  m->savings = regs->array[regno].n_times_set;
 		  if (find_reg_note (p, REG_RETVAL, NULL_RTX))
 		    m->savings += libcall_benefit (p);
-		  for (i = 0; i < (int) LOOP_REGNO_NREGS (regno, SET_DEST (set)); i++)
+		  for (i = 0; i < LOOP_REGNO_NREGS (regno, SET_DEST (set)); i++)
 		    regs->array[regno+i].set_in_loop = move_insn ? -2 : -1;
 		  /* Add M to the end of the chain MOVABLES.  */
 		  loop_movables_add (movables, m);
@@ -1050,7 +1050,7 @@ scan_loop (loop, flags)
 		      m->lifetime = LOOP_REG_LIFETIME (loop, regno);
 		      m->savings = 1;
 		      for (i = 0;
-			   i < (int) LOOP_REGNO_NREGS (regno, SET_DEST (set));
+			   i < LOOP_REGNO_NREGS (regno, SET_DEST (set));
 			   i++)
 			regs->array[regno+i].set_in_loop = -1;
 		      /* Add M to the end of the chain MOVABLES.  */
@@ -2193,7 +2193,7 @@ move_movables (loop, movables, threshold
 	      if (! m->partial)
 		{
 		  int i;
-		  for (i = 0; i < (int) LOOP_REGNO_NREGS (regno, m->set_dest); i++)
+		  for (i = 0; i < LOOP_REGNO_NREGS (regno, m->set_dest); i++)
 		    regs->array[regno+i].set_in_loop = 0;
 		}
 
@@ -2258,7 +2258,7 @@ move_movables (loop, movables, threshold
 			{
 			  int i;
 			  for (i = 0;
-			       i < (int) LOOP_REGNO_NREGS (regno, m1->set_dest);
+			       i < LOOP_REGNO_NREGS (regno, m1->set_dest);
 			       i++)
 			    regs->array[m1->regno+i].set_in_loop = 0;
 			}
@@ -3519,7 +3519,7 @@ count_one_set (regs, insn, x, last_set)
 	{
 	  int i;
 	  int regno = REGNO (dest);
-	  for (i = 0; i < (int) LOOP_REGNO_NREGS (regno, dest); i++)
+	  for (i = 0; i < LOOP_REGNO_NREGS (regno, dest); i++)
 	    {
 	      /* If this is the first setting of this reg
 		 in current basic block, and it was set before,


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