[Bug tree-optimization/85420] missing -Wrestrict with -fsanitize=undefined

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 16 17:53:00 GMT 2018


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

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Whether that's a good or bad decision is a matter of opinion.  Most coding
guidelines advise against using strcpy even between distinct objects.  I happen
to think that's unnecessarily restrictive when the size of the destination is
known to be large enough for the source string, but I do feel it's unsafe to
use strcpy to copy substrings within the same array and that using memcpy is
preferable.  (The strengths and weaknesses of warnings and sanitizers are well
known and don't need to be debated here.)


More information about the Gcc-bugs mailing list