analyzer: fix ICE on bogus decl of memset [PR97130]
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 21 Sep 2020 15:59:26 +0000 (11:59 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 21 Sep 2020 22:50:08 +0000 (18:50 -0400)
commit1e19ecd79b45af6df87a6869d1936b857c9f71fc
tree1964506c67511ce7de835f3315e163032f1bae3d
parent15e7b93ba4256884c90198c678ed7eded4e73464
analyzer: fix ICE on bogus decl of memset [PR97130]

Verify that arguments are pointers before calling handling code
that calls deref_rvalue on them.

gcc/analyzer/ChangeLog:
PR analyzer/97130
* region-model-impl-calls.cc (call_details::get_arg_type): New.
* region-model.cc (region_model::on_call_pre): Check that the
initial arg is a pointer before calling impl_call_memset and
impl_call_strlen.
* region-model.h (call_details::get_arg_type): New decl.

gcc/testsuite/ChangeLog:
PR analyzer/97130
* gcc.dg/analyzer/pr97130.c: New test.
gcc/analyzer/region-model-impl-calls.cc
gcc/analyzer/region-model.cc
gcc/analyzer/region-model.h
gcc/testsuite/gcc.dg/analyzer/pr97130.c [new file with mode: 0644]