-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sizeof(wchar_t) == 1 on GCC 6.5.0 #169
Comments
Further testing shows that this is consistent between i386 and x86_64 GCC 6.5.0 cross & native as well as x86_64 10.5.0 cross and native: echo "" | ./x86_64-aros-gcc -E - -dM | grep WCHAR
echo "" | ./x86_64-aros-gcc -E - -dM -fshort-wchar | grep WCHAR Furthermore there is -fshort-wchar option which then changes size to 2 bytes:
Which in default mode should be downgrading wchar_t from 4 to 2 bytes, but now it's actually upgrading it! |
Quote of GCC docs: "Override the underlying type for wchar_t to be short unsigned int instead of the default for the target. This option is useful for building programs to run under WINE. Warning: the -fshort-wchar switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface." |
AROS patch for GCC 6.5.0 explicitly sets wchar as 8 bit char. Looking at history it has been this way since first version (2019) gcc/config/aros.h +#undef WCHAR_TYPE This needs to be changed to either 'int' or 'unsigned int'. Seems like some systems use 'unsigned' and also python 3.x checks whether wchar_t is unsigned to decide if it is "usable" |
For some reason, sizeof(wchar_t) is 1 on GCC 6.5.0. This is wrong as wchar_t should be 4 bytes long - otherwise it is no different than char. Also builtin define __ WCHAR_TYPE __ gets resolved for some reason to 'char'.
Need to check with GCC 10.5.0. If it was fixed, that it actually breaks binary compatibility with current "wrong" wc#? functions exposed in stdlib.library
The text was updated successfully, but these errors were encountered: