analyzer: fix ICE when handling callback exceeds enode limit [PR97514]

gcc/analyzer/ChangeLog:
	PR analyzer/97514
	* engine.cc (exploded_graph::add_function_entry): Handle failure
	to create an enode, rather than asserting.

gcc/testsuite/ChangeLog:
	PR analyzer/97514
	* gcc.dg/analyzer/pr97514.c: New test.
This commit is contained in:
David Malcolm 2020-10-22 06:16:28 -04:00
parent 9ed7b339c9
commit f7decfaebb
2 changed files with 21 additions and 2 deletions

View File

@ -1956,8 +1956,9 @@ exploded_graph::add_function_entry (function *fun)
return NULL;
exploded_node *enode = get_or_create_node (point, state, NULL);
/* We should never fail to add such a node. */
gcc_assert (enode);
if (!enode)
return NULL;
add_edge (m_origin, enode, NULL);
m_functions_with_enodes.add (fun);

View File

@ -0,0 +1,18 @@
/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=0 -Wno-analyzer-too-complex" } */
typedef void (*sighandler_t) (int);
void
signal (int, sighandler_t);
static void
kw (int signum)
{
(void) signum;
}
void
gk (int ot)
{
signal (ot, kw);
}