static int type_is_full_subrange_of_target_type (struct type *type) { struct type *subtype; if (TYPE_CODE (type) != TYPE_CODE_RANGE) return 0; subtype = TYPE_TARGET_TYPE (type); if (subtype == NULL) return 0; if (is_dynamic_type (type)) return 0; if (ada_discrete_type_low_bound (type) != ada_discrete_type_low_bound (subtype)) return 0; if (ada_discrete_type_high_bound (type) != ada_discrete_type_high_bound (subtype)) return 0; return 1; }
struct value * value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) { struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); ULONGEST elt_size = type_length_units (elt_type); ULONGEST elt_offs = elt_size * (index - lowerbound); if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) && elt_offs >= type_length_units (array_type)) || (VALUE_LVAL (array) != lval_memory && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type))) { if (type_not_associated (array_type)) error (_("no such vector element (vector not associated)")); else if (type_not_allocated (array_type)) error (_("no such vector element (vector not allocated)")); else error (_("no such vector element")); } if (is_dynamic_type (elt_type)) { CORE_ADDR address; address = value_address (array) + elt_offs; elt_type = resolve_dynamic_type (elt_type, NULL, address); } return value_from_component (array, elt_type, elt_offs); }