https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98097
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2020-12-02 Ever confirmed|0 |1 --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- The failure to diagnose this is due to the warning using the same conservative assumption as for the strcmp and strlen optimization. The optimization assumes that strlen(i->type) is bounded by the size of the object i points to if it can be determined, or by MAX_OBJECT_SIZE if not. (You'll recall the long, contentious discussion about this.) This assumption is overly conservative for warnings but because -Wstring-compare was an optimization first and the warning only an afterthought (after testing showed the optimization didn't trigger enough to matter), I didn't remember to decouple the two. Let me do that.