]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: fix ICE when throw-handling hits svalue complexity limit [PR124139]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 17 Feb 2026 23:04:16 +0000 (18:04 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 17 Feb 2026 23:04:16 +0000 (18:04 -0500)
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 <dmalcolm@redhat.com>
gcc/analyzer/engine.cc
gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C [new file with mode: 0644]

index 8dc9a8b78ce32e4a2f8297d1981af25448d62e91..a4d870bd3d242ad49c6e6244e8384b8cb2cd3f9c 100644 (file)
@@ -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 (file)
index 0000000..4def4f0
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-additional-options "--param=analyzer-max-svalue-depth=0" }
+
+void
+foo()
+{
+  throw;
+}