mapping, but are required to use an svalue, such as when handling
compound assignments and compound return values.
+ All keys within the underlying binding_map are required to be concrete,
+ not symbolic.
+
Instances of this class shouldn't be bound as-is into the store;
instead they should be unpacked. Similarly, they should not be
nested. */
const binding_map *m_map_ptr;
};
- compound_svalue (tree type, const binding_map &map)
- : svalue (calc_complexity (map), type),
- m_map (map)
- {
- }
+ compound_svalue (tree type, const binding_map &map);
enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_COMPOUND; }
const compound_svalue *dyn_cast_compound_svalue () const { return this; }
const binding_key *k
= binding_key::make (mgr->get_store_manager (), child_reg,
BK_direct);
+ /* Handle the case where we have an unknown size for child_reg
+ (e.g. due to it being a trailing field with incomplete array
+ type. */
+ if (!k->concrete_p ())
+ {
+ /* Assume that sval has a well-defined size for this case. */
+ tree sval_type = sval->get_type ();
+ gcc_assert (sval_type);
+ HOST_WIDE_INT sval_byte_size = int_size_in_bytes (sval_type);
+ gcc_assert (sval_byte_size != -1);
+ bit_size_t sval_bit_size = sval_byte_size * BITS_PER_UNIT;
+ /* Get offset of child relative to base region. */
+ region_offset child_base_offset = child_reg->get_offset ();
+ gcc_assert (!child_base_offset.symbolic_p ());
+ /* Convert to an offset relative to the parent region. */
+ region_offset parent_base_offset = parent_reg->get_offset ();
+ gcc_assert (!parent_base_offset.symbolic_p ());
+ bit_offset_t child_parent_offset
+ = (child_base_offset.get_bit_offset ()
+ - parent_base_offset.get_bit_offset ());
+ /* Create a concrete key for the child within the parent. */
+ k = mgr->get_store_manager ()->get_concrete_binding
+ (child_parent_offset, sval_bit_size, BK_direct);
+ }
+ gcc_assert (k->concrete_p ());
put (k, sval);
}
}
/* class compound_svalue : public svalue. */
+compound_svalue::compound_svalue (tree type, const binding_map &map)
+: svalue (calc_complexity (map), type), m_map (map)
+{
+ /* All keys within the underlying binding_map are required to be concrete,
+ not symbolic. */
+#if CHECKING_P
+ for (iterator_t iter = begin (); iter != end (); ++iter)
+ {
+ const binding_key *key = (*iter).first;
+ gcc_assert (key->concrete_p ());
+ }
+#endif
+}
+
/* Implementation of svalue::dump_to_pp vfunc for compound_svalue. */
void
--- /dev/null
+struct ge {
+ char au;
+ char pz[];
+};
+
+struct ge tr = { 'X', 'X', };
+
+int
+main (void)
+{
+ return tr.pz[0] == 'X';
+}