Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
Pushed to trunk as r16-7559-g5869ac36fadbfa.

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]>
---
 gcc/analyzer/engine.cc                                 | 3 +++
 gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C | 7 +++++++
 2 files changed, 10 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/analyzer/exception-ice-pr124139.C

diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 8dc9a8b78ce32..a4d870bd3d242 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 0000000000000..4def4f0c13b2a
--- /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;
+}
-- 
2.26.3

Reply via email to