analyzer: fix ICE on function pointer casts [PR 93775]
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 17 Feb 2020 08:06:14 +0000 (03:06 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 18 Feb 2020 01:18:03 +0000 (20:18 -0500)
commitd8cde6f9c223f1b6d4f4e4e07088f08a629b7c2a
tree275bdf0203735282e45a0b56640c5cad3b1bca3a
parent1ee98e41383e2c76572c4cbc9a526e9ae63115a2
analyzer: fix ICE on function pointer casts [PR 93775]

PR analyzer/93775 reports an ICE in cgraph_node::get when -fanalyzer is
used on code that calls a function pointer that was generated via a cast
from a non-function.

This patch fixes it by bulletproofing region_model::get_fndecl_for_call
for the case where the code_region's get_tree_for_child_region returns
NULL.

gcc/analyzer/ChangeLog:
PR analyzer/93775
* region-model.cc (region_model::get_fndecl_for_call): Handle the
case where the code_region's get_tree_for_child_region returns
NULL.

gcc/testsuite/ChangeLog:
PR analyzer/93775
* gcc.dg/analyzer/20020129-1.c: New test.
gcc/analyzer/ChangeLog
gcc/analyzer/region-model.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/20020129-1.c [new file with mode: 0644]