https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119867
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |88443 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So with _GLIBCXX_ASSERTIONS, there is a check that is added to oeprator[]. that the `index <= size` as `&res[size]` is well defined. So what happens is the vectorizer vectorizes up to and including 33 as the index. And that write is still there which does show an undefinedness in the original code really. If we add a check to make sure idx2 is within the range of the length of the array before the loop, then we (correctly) get memset for the loop. I am not 100% sure we can call this a false positive since the compiler has no knowledge of the ranges of idx1 and idx2 here. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings