static void
add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree bound)
{
- int want_address = 2;
-
switch (TREE_CODE (bound))
{
case ERROR_MARK:
add_AT_die_ref (subrange_die, bound_attr, decl_die);
break;
}
- want_address = 0;
}
/* FALLTHRU */
dw_die_ref ctx, decl_die;
dw_loc_list_ref list;
- list = loc_list_from_tree (bound, want_address);
- if (list == NULL)
- break;
-
- if (single_element_loc_list_p (list))
+ list = loc_list_from_tree (bound, 2);
+ if (list == NULL || single_element_loc_list_p (list))
{
- add_AT_loc (subrange_die, bound_attr, list->expr);
- break;
+ /* If DW_AT_*bound is not a reference nor constant, it is
+ a DWARF expression rather than location description.
+ For that loc_list_from_tree (bound, 0) is needed.
+ If that fails to give a single element list,
+ fall back to outputting this as a reference anyway. */
+ dw_loc_list_ref list2 = loc_list_from_tree (bound, 0);
+ if (list2 && single_element_loc_list_p (list2))
+ {
+ add_AT_loc (subrange_die, bound_attr, list2->expr);
+ break;
+ }
}
+ if (list == NULL)
+ break;
if (current_function_decl == 0)
ctx = comp_unit_die;