This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix sign extension in cpplex.c
- From: Andreas Jaeger <aj at suse dot de>
- To: "Ulrich Weigand" <Ulrich dot Weigand at de dot ibm dot com>
- Cc: Neil Booth <neil at daikokuya dot demon dot co dot uk>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 06 Feb 2002 09:58:03 +0100
- Subject: Re: Fix sign extension in cpplex.c
- References: <OF25FE401D.2086DCA2-ONC1256B57.00684345@de.ibm.com>
"Ulrich Weigand" <Ulrich.Weigand@de.ibm.com> writes:
> Neil Booth wrote:
>
>>> >From my reading of the standard, the warning appears correct as
>>> the integer character constant '\xff' has the value 255 on an
>>> implementation where char is unsigned (and 8-bit). This value
>>> is indeed too large to represent in a variable of type 'signed char'.
>>>
>>> Is this a bug in test case (or was the warning incorrect after all)?
>>
>>It looks to me like Andreas' bug fix was correct, but that the test case
>>is bogus on some archs like you say.
>
> Hmm, as it is supposed to test sign extension, maybe we should
> simply add a
>
> /* { dg-options "-fsigned-char" } */
>
> to the test case?
That shouldn't make a difference since the code already uses
signed/unsigned explicitly:
signed char c = '\xff';
unsigned char d = '\xff';
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj