analyzer: handle memmove like memcpy
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 9 Dec 2022 02:19:23 +0000 (21:19 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 9 Dec 2022 02:19:23 +0000 (21:19 -0500)
commitcf80a23e19db83b7cb2220371d21642aa08261e0
treee6ca2dd6f4cb71f17a3e407e4c6cc1c3c0a8fe12
parent2996b5c053d38d4543c9491258b051d6c032a011
analyzer: handle memmove like memcpy

gcc/analyzer/ChangeLog:
* region-model-impl-calls.cc (class kf_memcpy): Rename to...
(class kf_memcpy_memmove): ...this.
(kf_memcpy::impl_call_pre): Rename to...
(kf_memcpy_memmove::impl_call_pre): ...this, and check the src for
poison.
(register_known_functions): Update for above renaming, and
register BUILT_IN_MEMMOVE and BUILT_IN_MEMMOVE_CHK.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/memcpy-1.c (test_8a, test_8b): New tests.
* gcc.dg/analyzer/memmove-1.c: New test, based on memcpy-1.c
* gcc.dg/analyzer/out-of-bounds-1.c (test7): Update expected
result for uninit srcBuf.
* gcc.dg/analyzer/out-of-bounds-5.c (test8, test9): Add
dg-warnings for memcpy from uninit src vla.
* gcc.dg/analyzer/pr104308.c (test_memmove_within_uninit):
Expect creation point note to be missing on riscv*-*-*.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/region-model-impl-calls.cc
gcc/testsuite/gcc.dg/analyzer/memcpy-1.c
gcc/testsuite/gcc.dg/analyzer/memmove-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-1.c
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
gcc/testsuite/gcc.dg/analyzer/pr104308.c