https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119248
Bug ID: 119248
Summary: Preprocessor arithmetic not done in intmax_t for
multichar literals
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: neil at gcc dot gnu.org
Target Milestone: ---
Quoting the standard [6.10.2 Conditional inclusion]: For the purposes of this
token conversion and evaluation, all signed integer types and all unsigned
integer types act as if they have the same representation as, respectively, the
types intmax_t and uintmax_t defined in the header <stdint.h>. This includes
interpreting character constants [...]
Therefore the below code should not #error:
#if 'abcde' == 'bcde'
#error
#endif
The error message reveals the underlying problem - 'int' does not have 4 bytes
in a CPP expression.
/tmp/bug.c:1:5: warning: multi-character literal with 5 characters exceeds
'int' size of 4 bytes
1 | #if 'abcde' == 'bcde'
| ^~~~~~~