[committed] analyzer: implement region_model::get_representative_path_var for labels
David Malcolm
dmalcolm@redhat.com
Tue Oct 27 13:58:04 GMT 2020
This fixes an ICE seen e.g. with gcc.dg/analyzer/data-model-16.c when
enabling -fdump-analyzer.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to master as 9e78634c74c540cad6a2ca447af0d5df1ac4c60b.
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 <const label_region *> (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.26.2
More information about the Gcc-patches
mailing list