]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: improve strdup handling [PR105899]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Aug 2023 14:57:42 +0000 (10:57 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Aug 2023 14:57:42 +0000 (10:57 -0400)
commitf687fc1ff6d4a44db87a35e9e3be7f20425bdacc
tree597efde3e2641ea1a4b8faba643893058cbbd934
parentd16af3ebea84749ac673db29a4124d2dc7cd369e
analyzer: improve strdup handling [PR105899]

gcc/analyzer/ChangeLog:
PR analyzer/105899
* kf.cc (kf_strdup::impl_call_pre): Set size of
dynamically-allocated buffer.  Simulate copying the string from
the source region to the new buffer.

gcc/testsuite/ChangeLog:
PR analyzer/105899
* c-c++-common/analyzer/pr99193-2.c: Add
-Wno-analyzer-too-complex.
* gcc.dg/analyzer/strdup-1.c: Include "analyzer-decls.h".
(test_concrete_strlen): New.
(test_symbolic_strlen): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/kf.cc
gcc/testsuite/c-c++-common/analyzer/pr99193-2.c
gcc/testsuite/gcc.dg/analyzer/strdup-1.c