Patchwork RFA: Fix moxie --enable-werror-always build

login
register
mail settings
Submitter Joern Rennecke
Date Nov. 11, 2010, 8:11 p.m.
Message ID <20101111151136.awo8wvsk8cs8wko4-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/70877/
State New
Headers show

Comments

Joern Rennecke - Nov. 11, 2010, 8:11 p.m.
built on i686-pc-linux-gnu with gcc (GCC) 4.6.0 20101111 (experimental) .
2010-11-11  Joern Rennecke  <amylaar@spamcop.net>

	PR target/46428
	* config/moxie/moxie.c (moxie_expand_prologue): Remove unused variables.
	* config/moxie/moxie.h (HARD_REGNO_OK_FOR_BASE_P): Cast num to
	HOST_WIDE_INT before comparing against zero.
Richard Henderson - Nov. 12, 2010, 5:28 p.m.
On 11/11/2010 12:11 PM, Joern Rennecke wrote:
> 	PR target/46428
> 	* config/moxie/moxie.c (moxie_expand_prologue): Remove unused variables.

This part is obviously ok.

> 	* config/moxie/moxie.h (HARD_REGNO_OK_FOR_BASE_P): Cast num to
> 	HOST_WIDE_INT before comparing against zero.

This bit I don't like.  REGNO's are supposed to be unsigned int values.
I would prefer a change like

-  ((NUM) >= 0 && (NUM) < FIRST_PSEUDO_REGISTER \
+  ((unsigned) (NUM) < FIRST_PSEUDO_REGISTER \


r~

Patch

Index: config/moxie/moxie.c
===================================================================
--- config/moxie/moxie.c	(revision 166609)
+++ config/moxie/moxie.c	(working copy)
@@ -317,7 +317,7 @@  moxie_expand_prologue (void)
 moxie_expand_epilogue (void)
 {
   int regno;
-  rtx insn, reg, cfa_restores = NULL;
+  rtx reg;
 
   if (cfun->machine->callee_saved_reg_size != 0)
     {
@@ -340,7 +340,7 @@  moxie_expand_epilogue (void)
 	    && df_regs_ever_live_p (regno))
 	  {
 	    rtx preg = gen_rtx_REG (Pmode, regno);
-	    insn = emit_insn (gen_movsi_pop (reg, preg));
+	    emit_insn (gen_movsi_pop (reg, preg));
 	  }
     }
 
Index: config/moxie/moxie.h
===================================================================
--- config/moxie/moxie.h	(revision 166609)
+++ config/moxie/moxie.h	(working copy)
@@ -405,7 +405,7 @@  #define INITIAL_ELIMINATION_OFFSET(FROM,
 #define INDEX_REG_CLASS NO_REGS
 
 #define HARD_REGNO_OK_FOR_BASE_P(NUM) \
-  ((NUM) >= 0 && (NUM) < FIRST_PSEUDO_REGISTER \
+  ((HOST_WIDE_INT) (NUM) >= 0 && (NUM) < FIRST_PSEUDO_REGISTER \
    && (REGNO_REG_CLASS(NUM) == GENERAL_REGS \
        || (NUM) == HARD_FRAME_POINTER_REGNUM))