[Bug tree-optimization/96951] strncpy truncation warning does not recognize truncation check
kab at acm dot org
gcc-bugzilla@gcc.gnu.org
Tue Sep 8 12:38:08 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96951
--- Comment #5 from kab at acm dot org ---
(In reply to Martin Sebor from comment #3)
> If in the code the test case was derived from the string
> member is not necessarily meant to be a string then declaring it with
> attribute nonstring avoids the warning:
In the original code the string is intended to be a nul-terminated string.
Also, its in a struct from a system header, so not modifiable.
> As for memccpy...
memccpy isn't so portable (think Windows, which deprecates it, though under the
control of a macro). The code from the discussion that led here could cope
with that, but that's not universally true.
More information about the Gcc-bugs
mailing list