This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to eliminate some signed/unsigned warnings
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch to eliminate some signed/unsigned warnings
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 31 Aug 2001 12:04:28 -0400 (EDT)
Patch eliminates these warnings:
> combine.c:8508: warning: comparison between signed and unsigned
> combine.c:8508: warning: signed and unsigned type in conditional expression
> genattrtab.c:754: warning: comparison between signed and unsigned
> predict.c:822: warning: comparison between signed and unsigned
Bootstrapped on solaris2.7, no regressions.
Okay to install?
--Kaveh
2001-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* combine.c (num_sign_bit_copies): Avoid signed/unsigned
warnings.
* genattrtab.c (attr_printf): Likewise.
* predict.c (expensive_function_p): Likewise.
diff -rup orig/egcs-CVS20010829/gcc/combine.c egcs-CVS20010829/gcc/combine.c
--- orig/egcs-CVS20010829/gcc/combine.c Mon Aug 27 22:16:14 2001
+++ egcs-CVS20010829/gcc/combine.c Thu Aug 30 17:51:54 2001
@@ -8505,8 +8505,8 @@ num_sign_bit_copies (x, mode)
if (! POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode
&& (code == PLUS || code == MINUS)
&& GET_CODE (XEXP (x, 0)) == REG && REG_POINTER (XEXP (x, 0)))
- result = MAX ((GET_MODE_BITSIZE (Pmode)
- - GET_MODE_BITSIZE (ptr_mode) + 1),
+ result = MAX ((int)(GET_MODE_BITSIZE (Pmode)
+ - GET_MODE_BITSIZE (ptr_mode) + 1),
result);
#endif
return result;
diff -rup orig/egcs-CVS20010829/gcc/genattrtab.c egcs-CVS20010829/gcc/genattrtab.c
--- orig/egcs-CVS20010829/gcc/genattrtab.c Wed Aug 29 14:24:11 2001
+++ egcs-CVS20010829/gcc/genattrtab.c Thu Aug 30 17:56:05 2001
@@ -750,7 +750,7 @@ attr_printf VPARAMS ((register int len,
VA_FIXEDARG (p, int, len);
VA_FIXEDARG (p, const char *, fmt);
- if (len > (sizeof(str) - 1)) /* leave room for \0 */
+ if (len > ((int)sizeof(str) - 1)) /* leave room for \0 */
abort ();
vsprintf (str, fmt, p);
diff -rup orig/egcs-CVS20010829/gcc/predict.c egcs-CVS20010829/gcc/predict.c
--- orig/egcs-CVS20010829/gcc/predict.c Sun Aug 26 07:13:40 2001
+++ egcs-CVS20010829/gcc/predict.c Thu Aug 30 17:58:42 2001
@@ -791,7 +791,7 @@ bool
expensive_function_p (threshold)
int threshold;
{
- unsigned int sum = 0;
+ int sum = 0;
int i;
int limit;