https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103483
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=103332 Ever confirmed|0 |1 Last reconfirmed| |2021-11-30 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > I think the warning is correct really. It's wrong. > as if > d is a+1000 it is undefined. Without inlining there is no way to know if d > is any value. It's able to inline the size of the buffer all the way down to the char_traits::copy call, but isn't able to inline the length argument as well. If it can't use the compile-time constant length that is present in the code, it shouldn't bother doing these checks. The middle-end should not assume all code is wrong by default. These bogus stringop warnings in std::string are getting out of hand. See also PR103332 and others.