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]

Re: Fix sign extension in cpplex.c


"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


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