From: David Malcolm Date: Tue, 17 Feb 2026 23:04:16 +0000 (-0500) Subject: analyzer: fix ICE when throw-handling hits svalue complexity limit [PR124139] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5869ac36fadbfac9a08e4bd15bff9503ebb00304;p=thirdparty%2Fgcc.git analyzer: fix ICE when throw-handling hits svalue complexity limit [PR124139] gcc/analyzer/ChangeLog: PR analyzer/124139 * engine.cc (exploded_node::on_throw): Bail out if we can't get the fndecl for the call. gcc/testsuite/ChangeLog: PR analyzer/124139 * g++.dg/analyzer/exception-ice-pr124139.C: New test. Signed-off-by: David Malcolm --- diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 8dc9a8b78ce..a4d870bd3d2 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -1811,6 +1811,9 @@ exploded_node::on_throw (exploded_graph &eg, region_model *model = new_state->m_region_model; call_details cd (throw_call, model, ctxt); + if (!cd.get_fndecl_for_call ()) + return; + /* Create an enode and eedge for the "throw". */ tree type = NULL_TREE; if (is_rethrow) diff --git a/gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C b/gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C new file mode 100644 index 00000000000..4def4f0c13b --- /dev/null +++ b/gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C @@ -0,0 +1,7 @@ +// { dg-additional-options "--param=analyzer-max-svalue-depth=0" } + +void +foo() +{ + throw; +}