[patch 10/10] debug-early merge: compiler proper

Aldy Hernandez aldyh@redhat.com
Thu May 28 20:12:00 GMT 2015


On 05/27/2015 08:39 AM, Jason Merrill wrote:
> On 05/20/2015 11:50 AM, Aldy Hernandez wrote:

>> +  /* Fill in the size of variable-length fields in late dwarf.  */
>> +  if (TREE_ASM_WRITTEN (type)
>> +      && !early_dwarf_dumping)
>> +    {
>> +      tree member;
>> +      for (member = TYPE_FIELDS (type); member; member = DECL_CHAIN
>> (member))
>> +    fill_variable_array_bounds (TREE_TYPE (member));
>> +      return;
>> +    }
>
> Why is this happening in late dwarf?  I'm concerned that front-end
> information that is necessary to do this might be lost by that point.

I thought only after the optimizations had run their course would we be 
guaranteed to have accurate bound information.  At least, that's what my 
experience showed.

Do you have something else in mind?

>
>> +      /* Variable-length types may be incomplete even if
>> +     TREE_ASM_WRITTEN.  For such types, fall through to
>> +     gen_array_type_die() and possibly fill in
>> +     DW_AT_{upper,lower}_bound attributes.  */
>> +      if ((TREE_CODE (type) != ARRAY_TYPE
>> +       && TREE_CODE (type) != RECORD_TYPE
>> +       && TREE_CODE (type) != UNION_TYPE
>> +       && TREE_CODE (type) != QUAL_UNION_TYPE)
>> +      || (TYPE_SIZE (type)
>> +          && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
>
> Similarly, why check for INTEGER_CST here?

The INTEGER_CST check was supposed to mean "we have bound information 
already, no need to look further".

I guess we could have a variable length bound that does not decay to a 
constant.  Perhaps I could check the presence of a cached DIE with a 
type DIE containing a DW_TAG_subrange_type *and* 
DW_AT_{lower,upper}_bound ??.  Basically I just want to add bound 
information, if available and not already present.

Suggestions?

Aldy



More information about the Gcc-patches mailing list