Hi,
vector types are represented as array types with DW_AT_GNU_vector attribute in
the debug info and a range [0 .. TYPE_VECTOR_SUBPARTS - 1]. That's obviously
skewed toward the C family of languages, therefore the attached patch changes
the lower bound to the default for the language of the CU, if any.
Tested on x86-64/Linux, OK for the mainline?
gcc/
* dwarf2out.cc (gen_array_type_die): Use the default lower bound of
the language for vector types.
--
Eric Botcazou
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index b468a4b9c0f..149aeaf1a55 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -22539,11 +22539,14 @@ gen_array_type_die (tree type, dw_die_ref context_die)
if (TREE_CODE (type) == VECTOR_TYPE)
{
- /* For VECTOR_TYPEs we use an array die with appropriate bounds. */
+ /* For VECTOR_TYPEs we use an array DIE with appropriate bounds. */
+ int lb = lower_bound_default ();
+ if (lb == -1)
+ lb = 0;
dw_die_ref subrange_die = new_die (DW_TAG_subrange_type, array_die, NULL);
- add_bound_info (subrange_die, DW_AT_lower_bound, size_zero_node, NULL);
+ add_bound_info (subrange_die, DW_AT_lower_bound, size_int (lb), NULL);
add_bound_info (subrange_die, DW_AT_upper_bound,
- size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL);
+ size_int (lb + TYPE_VECTOR_SUBPARTS (type) - 1), NULL);
}
else
add_subscript_info (array_die, type, collapse_nested_arrays);