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]

Patch for sparcv9 -Werror break in ggc-common.c


Bootstrapping the trunk on sparcv9-solaris2.7, I get:

 > ggc-common.c: In function `ggc_rlimit_bound':
 > ggc-common.c:650: warning: comparison between signed and unsigned
 > ggc-common.c:656: warning: comparison between signed and unsigned
 > make[2]: *** [ggc-common.o] Error 1

It occurs on this code:

 > rlim.rlim_cur != RLIM_INFINITY


This occurs because in LP64 (V9) mode rlim_t is `unsigned long', but
RLIM_INFINITY is defined as -3L.

This only happens in V9 mode, not on regular sparc-* (V7?)

Fixed with the following patch which was bootstrapped with the trunk
on sparcv9-sun-solaris2.7.

Ok for trunk and 3.3?

		Thanks,
		--Kaveh



2003-03-02  Kaveh R. Ghazi  <ghazi at caip dot rutgers dot edu>

	* ggc-common.c (ggc_rlimit_bound): Cast RLIM_INFINITY to avoid
	warnings.

--- orig/egcc-CVS20030302/gcc/ggc-common.c	2003-02-23 11:54:53.000000000 -0500
+++ egcc-CVS20030302/gcc/ggc-common.c	2003-03-02 09:14:17.242563000 -0500
@@ -640,19 +640,19 @@ ggc_rlimit_bound (limit)
   struct rlimit rlim;
 # ifdef RLIMIT_RSS
   if (getrlimit (RLIMIT_RSS, &rlim) == 0
-      && rlim.rlim_cur != RLIM_INFINITY
+      && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
       && rlim.rlim_cur < limit)
     limit = rlim.rlim_cur;
 # endif
 # ifdef RLIMIT_DATA
   if (getrlimit (RLIMIT_DATA, &rlim) == 0
-      && rlim.rlim_cur != RLIM_INFINITY
+      && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
       && rlim.rlim_cur < limit)
     limit = rlim.rlim_cur;
 # endif
 # ifdef RLIMIT_AS
   if (getrlimit (RLIMIT_AS, &rlim) == 0
-      && rlim.rlim_cur != RLIM_INFINITY
+      && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
       && rlim.rlim_cur < limit)
     limit = rlim.rlim_cur;
 # endif




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