https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110645

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
In the bowels of the relevant code, if we don't know the range of the source
size, then we set is to the range of the destination size.  I vaguely recall
Martin doing this, but nothing about the reasoning behind that choice.

I think the bigger question here is whether or not we can really rely on the
declared type of the input string which is a 2 character array, so the length
will be 0 or 1.  I think from a C/C++ standards point of view we likely can,
but in practice I'm less sure.

And then we'd need to plumb that into the restrict warning code.  It already
has some notion that strlen is important in bounding various string related
things, so it shouldn't be *that* hard to use it elsewhere, at least in theory.

But not anything I'm working on.  Just noting thoughts after a bit of
investigation.

Reply via email to