On Fri, Feb 24, 2017 at 3:58 AM, Jakub Jelinek <ja...@redhat.com> wrote: > + copy = ggc_alloc<dw_loc_descr_node> (); > + memcpy (copy, ref, sizeof (dw_loc_descr_node)); > + list->expr = copy; > + while (copy->dw_loc_next != ref_end) > + { > + dw_loc_descr_ref new_copy = ggc_alloc<dw_loc_descr_node> (); > + memcpy (new_copy, copy->dw_loc_next, sizeof (dw_loc_descr_node)); > + copy->dw_loc_next = new_copy; > + copy = new_copy; > + }
This seems like it could use a copy_loc_descr function, shared with add_loc_descr_to_each. > + && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (loc))) > + <= DWARF2_ADDR_SIZE)) Is this condition necessary, given that DWARF 5 supports typed expressions that are not restricted to the size of the generic type? > @@ -27532,6 +27538,18 @@ prune_unused_types_walk_loc_descr (dw_lo > if (loc->dw_loc_oprnd1.val_class == dw_val_class_die_ref) > prune_unused_types_mark (loc->dw_loc_oprnd1.v.val_die_ref.die, 1); > break; > + case DW_OP_GNU_variable_value: > + if (loc->dw_loc_oprnd1.val_class == dw_val_class_decl_ref) > + { > + dw_die_ref ref > + = lookup_decl_die (loc->dw_loc_oprnd1.v.val_decl_ref); > + if (ref == NULL) > + break; > + loc->dw_loc_oprnd1.val_class = dw_val_class_die_ref; > + loc->dw_loc_oprnd1.v.val_die_ref.die = ref; > + loc->dw_loc_oprnd1.v.val_die_ref.external = 0; > + } Doing this adjustment in prune_unused_types is surprising. Why is it needed here as well as in the other places you do it? What if the user specifies -fno-eliminate-unused-debug-types? Jason