https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89688
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |83819 --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Actually, it's slightly more complicated. string_constant does fold the reference to the STRING_CST "2" but with the size of 1 because it doesn't consider the implicit zero that follows the '2'. Simply changing string_constant to look at the next element to see if it's zero isn't enough to handle the case when the zero is implicit because fold_ctor_reference called to extract the element value only handles explicit initializers. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83819 [Bug 83819] [meta-bug] missing strlen optimizations