arocc
arocc copied to clipboard
Single-narrow-char char literals should be sign extended on platforms where `char` is signed.
The following issues no errors on x86_64-linux but 2 errors for aro:
_Static_assert('\xFF' == -1, "");
#if '\xFF' != -1
#error comparison failed
#endif
This only applies to single-character literals; the following currently works as expected:
_Static_assert('\x00\xFF' == 255, "");
_Static_assert('\xFF\xFF' == 65535, "");
This should be fixable by intCast'ing the value from char -> destination type (int or intmax_t depending on if we're in the parser or preprocessor) if all the conditions are met (char is signed for the target, it's a regular char literal, it's a single byte, value is >= 128)