]> gcc.gnu.org Git - gcc.git/commit
analyzer: reimplement kf_strlen [PR105899]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 22 Aug 2023 22:36:54 +0000 (18:36 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 22 Aug 2023 22:36:54 +0000 (18:36 -0400)
commit3242fb533d48abab621618c4f183ca395de3dcd2
tree9f078434557dad522848162da24d36e9a803e2e0
parentf40d24cda74da5ed8c9b88641e55138c066c932f
analyzer: reimplement kf_strlen [PR105899]

Reimplement kf_strlen in terms of the new string scanning
implementation, sharing strlen's implementation with
__analyzer_get_strlen.

gcc/analyzer/ChangeLog:
PR analyzer/105899
* kf-analyzer.cc (class kf_analyzer_get_strlen): Move to kf.cc.
(register_known_analyzer_functions): Use make_kf_strlen.
* kf.cc (class kf_strlen::impl_call_pre): Replace with
implementation of kf_analyzer_get_strlen from kf-analyzer.cc.
Handle "UNKNOWN" return from check_for_null_terminated_string_arg
by falling back to a conjured svalue.
(make_kf_strlen): New.
(register_known_functions): Use make_kf_strlen.
* known-function-manager.h (make_kf_strlen): New decl.

gcc/testsuite/ChangeLog:
PR analyzer/105899
* gcc.dg/analyzer/null-terminated-strings-1.c: Update expected
results on symbolic values.
* gcc.dg/analyzer/strlen-1.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/kf-analyzer.cc
gcc/analyzer/kf.cc
gcc/analyzer/known-function-manager.h
gcc/testsuite/gcc.dg/analyzer/null-terminated-strings-1.c
gcc/testsuite/gcc.dg/analyzer/strlen-1.c [new file with mode: 0644]
This page took 0.066998 seconds and 5 git commands to generate.