🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1051

GCC 2.2.2's source code sometimes uses `-1' in an unsigned context

#1051
From: Paul Eggert
Date: Thu, 03 Sep 1992 03:53
70 lines
2870 bytes
GCC 2.2.2's source code sometimes uses a constant expression equivalent to
`-1' in an unsigned context.  This is a little confusing, and it provokes
warning messages in some compilers.  Here is a patch.

Thu Sep  3 03:28:35 1992  Paul Eggert  (eggert@twinsun.com)

	* integrate.h (CONST_AGE_PARM): Make it unsigned, to avoid
	warnings about negative numbers in unsigned contexts.
	* unroll.c (copy_loop_body): Use `CONST_AGE_PARM', not `-1'.
	* combine.c (simplify_and_const_int): Cast ~0 to unsigned,
	for similar reasons.

===================================================================
RCS file: RCS/integrate.h,v
retrieving revision 2.2
diff -c2 -r2.2 integrate.h
*** integrate.h	1992/01/14 11:50:17	2.2
--- integrate.h	1992/09/03 03:28:35
***************
*** 71,75 ****
       A value of -1 indicates an entry for a reg which is a parm.
       All other values are "positive".  */
! #define CONST_AGE_PARM (-1)
    unsigned int const_age;
    /* In parallel with const_equiv_map, record the valid age for each entry.
--- 71,75 ----
       A value of -1 indicates an entry for a reg which is a parm.
       All other values are "positive".  */
! #define CONST_AGE_PARM ((unsigned) -1)
    unsigned int const_age;
    /* In parallel with const_equiv_map, record the valid age for each entry.
===================================================================
RCS file: RCS/unroll.c,v
retrieving revision 2.2
diff -c2 -r2.2 unroll.c
*** unroll.c	1992/05/27 22:10:02	2.2
--- unroll.c	1992/09/03 03:29:28
***************
*** 1662,1666 ****
  
  	      if (map->const_age_map[regno] == map->const_age)
! 		map->const_age_map[regno] = -1;
  	    }
  	  break;
--- 1662,1666 ----
  
  	      if (map->const_age_map[regno] == map->const_age)
! 		map->const_age_map[regno] = CONST_AGE_PARM;
  	    }
  	  break;

===================================================================
RCS file: RCS/combine.c,v
retrieving revision 2.2
diff -c2 -r2.2 combine.c
*** combine.c	1992/06/02 21:35:27	2.2
--- combine.c	1992/09/03 03:30:26
***************
*** 4988,4992 ****
  	      varop = plus_constant (XEXP (varop, 0),
  				     INTVAL (XEXP (varop, 1)) & constop);
! 	      constop = ~0;
  	      break;
  	    }
--- 4988,4992 ----
  	      varop = plus_constant (XEXP (varop, 0),
  				     INTVAL (XEXP (varop, 1)) & constop);
! 	      constop = (unsigned) ~0;
  	      break;
  	    }
Technical Details
Message-ID: <9209030353.AA26964@farside.twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert
From: eggert@twinsun.COM (Paul Eggert)
Subject: GCC 2.2.2's source code sometimes uses `-1' in an unsigned context
Message-ID: <9209030353.AA26964@farside.twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 3 Sep 1992 03:53:44 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 71