https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97631
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Sebor <mse...@gcc.gnu.org>: https://gcc.gnu.org/g:7f5ff78ff3f971c11ec67f422b2fd34281db9123 commit r11-7562-g7f5ff78ff3f971c11ec67f422b2fd34281db9123 Author: Martin Sebor <mse...@redhat.com> Date: Mon Mar 8 13:28:52 2021 -0700 PR middle-end/97631 - bogus "writing one too many bytes" warning for memcpy with strlen argument gcc/ChangeLog: PR middle-end/97631 * tree-ssa-strlen.c (maybe_warn_overflow): Test rawmem. (handle_builtin_stxncpy_strncat): Rename locals. Determine destination size from allocation calls. Issue a more appropriate kind of warning. (handle_builtin_memcpy): Pass true as rawmem to maybe_warn_overflow. (handle_builtin_memset): Same. gcc/testsuite/ChangeLog: PR middle-end/97631 * c-c++-common/Wstringop-overflow.c: Remove unexpected warnings. Add an xfail. * c-c++-common/Wstringop-truncation.c: Add expected warnings. * gcc.dg/Wstringop-overflow-10.c: Also enable -Wstringop-truncation. * gcc.dg/Wstringop-overflow-66.c: New test. * gcc.dg/tree-ssa/strncpy-2.c: Adjust expected warning.