Fix sign extension in cpplex.c

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Feb 7 07:54:00 GMT 2002


At 13:18 07.02.2002, Ulrich Weigand wrote:

>Andreas Jaeger wrote:
>
> >"Ulrich Weigand" <Ulrich.Weigand@de.ibm.com> writes:
> >
> >> Andreas Jaeger wrote:
> >>
> >>>"Ulrich Weigand" <Ulrich.Weigand@de.ibm.com> writes:
> >>>
> >>>> 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';
> >>
><> It makes a difference in how the *constant* is interpreted:
> >> with -fsigned-char, '\xff' is equivalent to -127, while with
> >> -funsigned-char, '\xff' is equivalent to 255 ...
> >
> >I see.  In that case your patch looks fine to me,
>
>OK, I've committed the following patch (tested on s390-ibm-linux
>and s390x-ibm-linux):
>
>ChangeLog:
>
>      * testsuite/gcc.dg/cpp/charconst-2.c: Add -fsigned-char option.

Nice, one FAIL less on powerpc-linux-gnu too :-). While we are at it, are 
there any testcases testing the warning/non-warning behaviour of such 
constants vs -fsigned-char/-funsigned-char? I can't find any...

Now I'm left with gcc.dg/charconst.c failing on powerpc-linux and 
sparc-solaris2.7 (but not on sparc-solaris2.8/sparc-linux???) because of a 
"overflow in implicit constant conversion". Could that be related to 
WCHAR_TYPE being "long int" on powerpc-linux?

Franz.



More information about the Gcc-patches mailing list