From 839a76553e6fd97be93fa25aeaf4d5eb294f4c32 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 23 Oct 2019 16:53:04 -0400 Subject: [PATCH 78/97] FIXME: fixups to region-model.cc --- gcc/analyzer/region-model.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 181bdc0..f25b03b 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -786,8 +786,6 @@ constant_svalue::get_child_sid (region *parent, region *child, if (parent->get_kind () == RK_MAP) { map_region *parent_map = static_cast (parent); - /* FIXME: passing child_rid here is awkward; look it up - by region rather than region_id. */ if (tree key = parent_map->get_tree_for_child_region (child, model)) { if (TREE_CODE (key) == INTEGER_CST) @@ -805,7 +803,19 @@ constant_svalue::get_child_sid (region *parent, region *child, } } + /* FIXME: handle the all-zeroes case by returning an all-zeroes of the + child type. + FIXME: similar for all-ones. */ + + /* Otherwise, we don't have a good way to get a child value out of a + constant. + + Handle this case by using an unknown value. */ + svalue *unknown_sval = new unknown_svalue (child->get_type ()); + return model.add_svalue (unknown_sval); +#if 0 return svalue::get_child_sid (parent, child, model, ctxt); +#endif } /* class unknown_svalue : public svalue. */ @@ -3814,9 +3824,12 @@ region_model::get_lvalue (path_var pv, region_model_context *ctxt) { tree array = TREE_OPERAND (expr, 0); tree index = TREE_OPERAND (expr, 1); +#if 0 // TODO: operands 2 and 3, if present: gcc_assert (TREE_OPERAND (expr, 2) == NULL_TREE); gcc_assert (TREE_OPERAND (expr, 3) == NULL_TREE); +#endif + region_id array_rid = get_lvalue (array, ctxt); #if 0 svalue_id index_sid = get_rvalue (index, ctxt); @@ -4462,7 +4475,7 @@ region_model::get_representative_path_var (region_id rid) const tree child_key = parent_map_region->get_tree_for_child_region (rid); path_var parent_pv = get_representative_path_var (parent_rid); /* FIXME: it is always a COMPONENT_REF? */ - if (parent_pv.m_tree) + if (parent_pv.m_tree && TREE_CODE (child_key) == FIELD_DECL) return path_var (build3 (COMPONENT_REF, TREE_TYPE (child_key), parent_pv.m_tree, child_key, NULL_TREE), -- 1.8.5.3