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

Richard Sandiford rdsandiford@googlemail.com
Wed Aug 21 21:01:00 GMT 2013


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.

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



More information about the Gcc-patches mailing list