Patchwork [wide-int] Fix signed vs. unsigned warning/error in mips.c

login
register
mail settings
Submitter Richard Sandiford
Date Aug. 21, 2013, 8:33 p.m.
Message ID <8738q2g4xq.fsf@talisman.default>
Download mbox | patch
Permalink /patch/268901/
State New
Headers show

Comments

Richard Sandiford - Aug. 21, 2013, 8:33 p.m.
In trunk this is a comparison between signed values, but uhwi probably
does make more sense here.

Tested on mips64-linux-gnu, where it fixes the build, and applied.

Richard


gcc/
	* config/mips/mips.c (r10k_safe_mem_expr_p): Fixed signed vs.
	unsigned warning.

Patch

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 201909)
+++ gcc/config/mips/mips.c	(working copy)
@@ -14902,7 +14902,7 @@ 
    a link-time-constant address.  */
 
 static bool
-r10k_safe_mem_expr_p (tree expr, HOST_WIDE_INT offset)
+r10k_safe_mem_expr_p (tree expr, unsigned HOST_WIDE_INT offset)
 {
   HOST_WIDE_INT bitoffset, bitsize;
   tree inner, var_offset;
@@ -14915,7 +14915,7 @@ 
     return false;
 
   offset += bitoffset / BITS_PER_UNIT;
-  return offset >= 0 && offset < tree_to_uhwi (DECL_SIZE_UNIT (inner));
+  return offset < tree_to_uhwi (DECL_SIZE_UNIT (inner));
 }
 
 /* A for_each_rtx callback for which DATA points to the instruction