https://gcc.gnu.org/g:5869ac36fadbfac9a08e4bd15bff9503ebb00304

commit r16-7559-g5869ac36fadbfac9a08e4bd15bff9503ebb00304
Author: David Malcolm <[email protected]>
Date:   Tue Feb 17 18:04:16 2026 -0500

    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 <[email protected]>

Diff:
---
 gcc/analyzer/engine.cc                                 | 3 +++
 gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 8dc9a8b78ce3..a4d870bd3d24 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 000000000000..4def4f0c13b2
--- /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;
+}

Reply via email to