From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19974 invoked by alias); 5 Feb 2003 19:12:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19964 invoked from network); 5 Feb 2003 19:12:52 -0000 Received: from unknown (HELO caip.rutgers.edu) (128.6.236.10) by 172.16.49.205 with SMTP; 5 Feb 2003 19:12:52 -0000 Received: (from ghazi@localhost) by caip.rutgers.edu (8.9.3/8.9.3) id OAA24523; Wed, 5 Feb 2003 14:12:49 -0500 (EST) Date: Wed, 05 Feb 2003 19:12:00 -0000 From: "Kaveh R. Ghazi" Message-Id: <200302051912.OAA24523@caip.rutgers.edu> To: dave@hiauly1.hia.nrc.ca Subject: Re: Mainline bootstrap failure on hppa2.0w-hp-hpux11.00 Cc: gcc-patches@gcc.gnu.org, roger@eyesopen.com References: <200302051846.h15IksUV006068@hiauly1.hia.nrc.ca> X-SW-Source: 2003-02/txt/msg00334.txt.bz2 > From: "John David Anglin" > > > I read in 6.3.1.8 which discusses the usual arithmetic conversions, > > > > Otherwise, if the type of the operand with the signed integer > > can represent all of the values of the type of the operand > > with unsigned integer type, then the operand with unsigned > > integer type is converted to the type of the operand with > > signed integer type. > > > > It seems as if this would apply to the case in question. Do we > > Thinking more, I am confused and it doesn't apply. While the integer > type can represent all possible values of the unsigned expression, it > can't represent all the values of the unsigned type. So, the latter > conversion would apply and I guess a warning should be generated, Correct, i.e. This will warn: expr ? unsigned int : int; This won't: expr ? unsigned char : int; The case under discussion is of the first form, even though the range of values is constrained with &. > although gcc should know the conversion is safe. > Dave How? GCC can't "know" the conversion is safe. The unsigned qty has a small range, but it's still an unsigned int type, so C mandates that the int qty (_isspace) gets promoted. GCC doesn't know the range of the int, that's the problem. If GCC knew _isspace was never negative, we wouldn't warn, same as with int constants like "1". Knowing that the unsigned portion is a small number doesn't help. --Kaveh -- Kaveh R. Ghazi ghazi@caip.rutgers.edu