gcc.dg/cpp/charconst.c vs. WCHAR_TYPE "long int"

Neil Booth neil@daikokuya.demon.co.uk
Fri Mar 22 15:47:00 GMT 2002


Franz Sirl wrote:-

> Hi,
> 
> the testcase gcc.dg/cpp/charconst.c fails on powerpc-linux-gnu because of 
> an extra warning on this line:
> 
>   c = L'very long';     /* { dg-warning "too long" "long wide charconst" } 
>   */
> 
> /home/fsirl/cvsx/gcc31/gcc/testsuite/gcc.dg/cpp/charconst.c: In function 
> `foo':
> /home/fsirl/cvsx/gcc31/gcc/testsuite/gcc.dg/cpp/charconst.c:28: warning: 
> overflow in implicit constant conversion
> 
> An additional (int) cast silences this extra warning, is this the right 
> thing to do?

This appears to be a bug in force_fit_type(), so I don't wish to
change the testcase to accommodate it.  Run the following in gdb
with a breakpoint on lex_charconst, when it stops, put a breakpoint
on force_fit_type, and run it to that breakpoint.  Watch the function
mangle the charconst.  With my cross compiler it goes in as 506806141029
and comes out as 101 with overflow; it should be unchanged IMO.

void foo () {
  int c;

  c = L'very long';
}

If I'm right, I find it scary that these number bugs in GCC are so common
and so persistent.

Neil.



More information about the Gcc mailing list