https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116082
Bug ID: 116082 Summary: -Wunterminated-string-initialization should not warn about strings that end with "\0" but should warn still for -Wc++-compat Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- This was reduced from the linux kernel sources, they add a "\0" to make sure it is always ends in a null character. -Wunterminated-string-initialization warns still in this case: ``` char t[31] = "CHARGE_CONTROL_START_THRESHOLD""\0"; ``` But it is not unterminated but rather it is just it is 31 character string with a null character as the end. Note we should still warn for -Wc++-compat since that is still invalid C++ code.