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]

Re: [PATCH/RFA] Avoid warnings in compiling config/sh/sh.c


Richard Henderson <rth@redhat.com> wrote:
> On Wed, Oct 27, 2004 at 01:57:25PM +0900, Kaz Kojima wrote:
>> @@ -5166,7 +5170,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
>>  	     (regs_ever_live[reg]
>>  	      || (call_really_used_regs[reg]
>>  		  && (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG
>> -		      || reg == PIC_OFFSET_TABLE_REGNUM)
>> +		      || reg == (int) PIC_OFFSET_TABLE_REGNUM)
>...
>> @@ -5688,7 +5692,7 @@ sh_expand_prologue (void)
>>  	       have a different natural size than the to-be-saved register.
>>  	       Thus, we gloss over the intermediate copy and pretend we do
>>  	       a direct save from the to-be-saved register.  */
>> -	    if (REGNO (reg_rtx) != reg)
>> +	    if (REGNO (reg_rtx) != (unsigned) reg)
> 
> Register numbers should be unsigned.  You should change
> the sign of 'reg' instead.

Sure.  Here is a revised patch.  It survives the native compiler
bootstrapping and there are no new regressions on i686-linux cross
sh4-unknown-linux-gnu.

Regards,
	kaz
--
2004-10-28  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.c (calc_live_regs): Declare reg as unsigned.
	Remove unnecessary casts.
	(sh_expand_prologue): Declare reg as unsigned.
	(sh_gimplify_va_arg_expr): Initinalize lab_over.
	(sh_handle_sp_switch_attribute): Add const qualifier appropriately.

diff -uprN ORIG/gcc/gcc/config/sh/sh.c TMP/gcc/gcc/config/sh/sh.c
--- ORIG/gcc/gcc/config/sh/sh.c	2004-10-25 16:59:25.000000000 +0900
+++ TMP/gcc/gcc/config/sh/sh.c	2004-10-28 07:57:05.000000000 +0900
@@ -5107,7 +5111,7 @@ shmedia_target_regs_stack_adjust (HARD_R
 static int
 calc_live_regs (HARD_REG_SET *live_regs_mask)
 {
-  int reg;
+  unsigned int reg;
   int count;
   int interrupt_handler;
   int pr_live, has_call;
@@ -5157,7 +5161,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
 	  || current_function_has_nonlocal_label))
     pr_live = 1;
   has_call = TARGET_SHMEDIA ? ! leaf_function_p () : pr_live;
-  for (count = 0, reg = FIRST_PSEUDO_REGISTER - 1; reg >= 0; reg--)
+  for (count = 0, reg = FIRST_PSEUDO_REGISTER - 1; reg != 0; reg--)
     {
       if (reg == (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG)
 	  ? pr_live
@@ -5179,13 +5183,13 @@ calc_live_regs (HARD_REG_SET *live_regs_
 	     (TARGET_SHCOMPACT
 	      && flag_pic
 	      && current_function_args_info.call_cookie
-	      && reg == (int) PIC_OFFSET_TABLE_REGNUM)
+	      && reg == PIC_OFFSET_TABLE_REGNUM)
 	     || (regs_ever_live[reg] && ! call_really_used_regs[reg])
 	     || (current_function_calls_eh_return
-		 && (reg == (int) EH_RETURN_DATA_REGNO (0)
-		     || reg == (int) EH_RETURN_DATA_REGNO (1)
-		     || reg == (int) EH_RETURN_DATA_REGNO (2)
-		     || reg == (int) EH_RETURN_DATA_REGNO (3)))
+		 && (reg == EH_RETURN_DATA_REGNO (0)
+		     || reg == EH_RETURN_DATA_REGNO (1)
+		     || reg == EH_RETURN_DATA_REGNO (2)
+		     || reg == EH_RETURN_DATA_REGNO (3)))
 	     || ((reg == MACL_REG || reg == MACH_REG)
 		 && regs_ever_live[reg]
 		 && sh_cfun_attr_renesas_p ())
@@ -5561,7 +5565,7 @@ sh_expand_prologue (void)
       for (entry = &schedule.entries[1]; entry->mode != VOIDmode; entry++)
         {
 	  enum machine_mode mode = entry->mode;
-	  int reg = entry->reg;
+	  unsigned int reg = entry->reg;
 	  rtx reg_rtx, mem_rtx, pre_dec = NULL_RTX;
 	  rtx orig_reg_rtx;
 
@@ -6408,7 +6412,7 @@ sh_gimplify_va_arg_expr (tree valist, tr
 {
   HOST_WIDE_INT size, rsize;
   tree tmp, pptr_type_node;
-  tree addr, lab_over, result = NULL;
+  tree addr, lab_over = NULL, result = NULL;
   int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
 
   if (pass_by_ref)
@@ -7188,7 +7192,7 @@ sh_handle_sp_switch_attribute (tree *nod
     }
   else
     {
-      char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
+      const char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
       sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s);
     }
 


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