From 9e78634c74c540cad6a2ca447af0d5df1ac4c60b Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 27 Oct 2020 09:48:00 -0400 Subject: [PATCH] analyzer: implement region_model::get_representative_path_var for labels This fixes an ICE seen e.g. with gcc.dg/analyzer/data-model-16.c when enabling -fdump-analyzer. gcc/analyzer/ChangeLog: * region-model.cc (region_model::get_representative_path_var): Implement case RK_LABEL. * region-model.h (label_region::get_label): New accessor. --- gcc/analyzer/region-model.cc | 5 ++++- gcc/analyzer/region-model.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 06c0c8668ac..9050b4424f8 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -2192,7 +2192,10 @@ region_model::get_representative_path_var (const region *reg, return path_var (function_reg->get_fndecl (), 0); } case RK_LABEL: - gcc_unreachable (); // TODO + { + const label_region *label_reg = as_a (reg); + return path_var (label_reg->get_label (), 0); + } case RK_SYMBOLIC: { diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index 5ad4a492f4f..3298d05ffda 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -1694,6 +1694,8 @@ public: void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; enum region_kind get_kind () const FINAL OVERRIDE { return RK_LABEL; } + tree get_label () const { return m_label; } + private: tree m_label; }; -- 2.30.2