https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100477
--- Comment #3 from andysem at mail dot ru --- To put it another way, the case of _size being large and n small is valid, and memset (and resize in general) do behave correctly in this case. Which is why the warning is bogus and the suggested assert is incorrect. Whether n became small is a separate matter unrelated to memset. You could argue that the line where n becomes small *as a result of overflow* could issue a warning. For example, if size_t was augmented with some sort of an attribute. But that is not what -Wstringop-overflow is.