From 4f40164a9322105012e9070eebd57ba80c69b873 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 17 Feb 2020 17:37:52 -0500 Subject: analyzer: fix ICE on failed casts [PR 93777] PR analyzer/93777 reports ICEs in a Fortran and C++ case involving a cast of a NULL pointer to a REFERENCE_TYPE. In both cases the call to build_cast fails and returns a NULL type, but region_model::maybe_cast_1 asserts that a non-NULL type was returned. This patch fixes the ICEs by converting the assertion to a conditional. gcc/analyzer/ChangeLog: PR analyzer/93777 * region-model.cc (region_model::maybe_cast_1): Replace assertion that build_cast returns non-NULL with a conditional, falling through to the logic which returns a new unknown value of the desired type if it fails. gcc/testsuite/ChangeLog: PR analyzer/93777 * g++.dg/analyzer/pr93777.C: New test. * gfortran.dg/analyzer/pr93777.f90: New test. --- gcc/analyzer/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/analyzer/ChangeLog') diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 05fb614..f4c6200 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,5 +1,13 @@ 2020-02-18 David Malcolm + PR analyzer/93777 + * region-model.cc (region_model::maybe_cast_1): Replace assertion + that build_cast returns non-NULL with a conditional, falling + through to the logic which returns a new unknown value of the + desired type if it fails. + +2020-02-18 David Malcolm + PR analyzer/93778 * engine.cc (impl_region_model_context::on_unknown_tree_code): Rename to... -- cgit v1.1