https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101633

            Bug ID: 101633
           Summary: [debug] DW_TAG_subrange_type missing DW_AT_upper_bound
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Filing FTR. ]

Consider gdb test-case p.adb / pck.adb / pck.ads (
https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/testsuite/gdb.ada/array_of_variant
).

When compiling like this:
...
$ gcc -S -fgnat-encodings=minimal -g p.adb -dA
...
we have with gcc 7.5.0:
...
        .uleb128 0x16   # (DIE (0x156) DW_TAG_array_type)
        .long   .LASF14 # DW_AT_name: "p__array_t"
        .long   0x145   # DW_AT_type
        .long   0x169   # DW_AT_sibling
        .uleb128 0x17   # (DIE (0x163) DW_TAG_subrange_type)
        .long   0x13e   # DW_AT_type
        .byte   0       # end of children of DIE 0x156
...
and the gdb test-case fails like this:
...
(gdb) print objects^M
$1 = ((tag => object, values => ()), (tag => unused))^M
(gdb) FAIL: gdb.ada/array_of_variant.exp: scenario=minimal: print entire array
...

In constrast, with gcc 8.5.0, we have:
...
        .uleb128 0x15   # (DIE (0x13b) DW_TAG_array_type)
        .long   .LASF14 # DW_AT_name: "p__array_t"
        .long   0x12a   # DW_AT_type
        .long   0x153   # DW_AT_sibling
        .uleb128 0x16   # (DIE (0x148) DW_TAG_subrange_type)
        .long   0x123   # DW_AT_type
        .uleb128 0x4    # DW_AT_upper_bound
        .byte   0x91    # DW_OP_fbreg
        .sleb128 -72
        .byte   0x6     # DW_OP_deref
        .byte   0       # end of children of DIE 0x13b
...
and the failing test passes like this:
...
(gdb) print objects^M
$1 = ((tag => object, values => (2, 2, 2, 2, 2)), (tag => unused))^M
(gdb) PASS: gdb.ada/array_of_variant.exp: scenario=minimal: print entire array
...

Reply via email to