CarlosAlbertoEnciso added a comment.

Hi @sdesmalen!

For the following test case

  int main() {
    int size = 2;
    int var[size];
    var[1] = 1;
    return 0;

I compared the DWARF generated by GCC and it looks like

  DW_TAG_variable "var"
    DW_AT_location ...
    DW_AT_type DW_FORM_ref4
        DW_AT_type -> "int"
          DW_AT_type -> "sizetype"
          DW_AT_upper_bound DW_FORM_exprloc [4] = { DW_OP_fbreg 0xffffffb8 
DW_OP_deref }

GCC use DW_AT_upper_bound with an associated location expression to describe 
the VLA boundaries.

In order to reduce the side effects created by the artifical-variable as 
described in my previous comment and to keep the generated DWARF within a 
reasonable size, I would suggest the GCC aproach as a size optimization.

The DWARF description of the artificial-variable could be removed and its 
location expression used by the array's subrange_type, instead of the 
subrange_type making a reference to the artificial-variable.


cfe-commits mailing list

Reply via email to