From msw's original email: #include <stdio.h> #include <stdlib.h> int main () { wchar_t widechars[3] = {(wchar_t)0xFFFD, (wchar_t)0xFFFD, (wchar_t)0xFFFD }; if (widechars[1] >> 5 != 2047) abort(); return 0; } [msw@localhost /tmp]$ gcc -fshort-wchar -o test test.c In file included from test.c:4294967295: <command line>: warning: "__WCHAR_TYPE__" redefined [msw@localhost /tmp]$ ./test [msw@localhost /tmp]$ g++ -fshort-wchar -o test test.c In file included from test.c:4294967295: <command line>: warning: "__WCHAR_TYPE__" redefined [msw@localhost /tmp]$ ./test Aborted (core dumped) (the value is -1, or (-3 << 5), as -3 is 0xfffffffd, and is what the array is initialized to in the C++ case) In the C++ test, wchar_t is being treated as signed, while in the C case it is not. The docs say: `-fshort-wchar' Override the underlying type for `wchar_t' to be `short unsigned int' instead of the default for the target. ... and jakub's response: There was a typo in cp/decl.c which set C++'s internal wchar_t type to the opposite sign of what it should have. I've just commited a fix for this into CVS head and it will make it into gcc-c++-2.96-70.
And also for reference here's the patch. http://gcc.gnu.org/ml/gcc-patches/2000-12/msg01369.html
Fixed in gcc-2.96-70 and above.