[llvm-bugs] [Bug 36322] New: Simpler DWARF for C99 VLAs

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 9 10:38:14 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36322

            Bug ID: 36322
           Summary: Simpler DWARF for C99 VLAs
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org

Filed on behalf of Carlos Enciso, who made this post-commit suggestion
on Phabricator D41698:

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_TAG_array_type 
        DW_AT_type -> "int"
        DW_TAG_subrange_type 
          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
(https://bugs.llvm.org/show_bug.cgi?id=30553#c3) 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180209/7d48f56e/attachment.html>


More information about the llvm-bugs mailing list