https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86415
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|TREE_STRING_LENGTH |strlen() not folded for |incorrect for constant |substrings within constant |arrays |arrays --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Let me change the summary to something less accusatory. I've always interpreted TREE_STRING_LENGTH according to its comment in tree.h: /* In a STRING_CST */ /* In C terms, this is sizeof, not strlen. */ #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length) but maybe for constant character arrays it's meant to refer to the result of sizeof(STR) where STR is string literal used to initialize the array and not necessarily to the size of the array.