On 2024-12-21 11:58, Jeffrey Walton wrote:
The string literal includes the trailing NULL, so the literal is 65
chars, not 64 char.

Yes, and the C standard says this is OK; there is a special rule saying that definitions like 'char arr[3] = "abc";' are fine.

I reported the overenthusiastic GCC diagnostic to the GCC maintainers here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178

and it appears that they're thinking of suppressing the diagnostic if the array is declared with the nonstring attribute. We might add such an attribute if they follow through, but in the meantime I'd just ignore the false positive.

Reply via email to