[llvm-commits] [llvm] r169218 - in /llvm/trunk: include/llvm/ lib/CodeGen/AsmPrinter/ lib/VMCore/ test/CodeGen/ARM/ test/CodeGen/Thumb/ test/CodeGen/X86/ test/DebugInfo/ test/DebugInfo/X86/ test/JitListener/

Eric Christopher echristo at gmail.com
Tue Dec 4 13:36:28 PST 2012


On Tue, Dec 4, 2012 at 1:18 PM, Robinson, Paul <Paul.Robinson at am.sony.com>wrote:

> So, you're adding a count to the metadata, but not emitting DW_AT_count?
> Am I understanding that correctly?  And a metadata count == -1 means you
> have an unknown upper bound?
>
> DWARF wants you to omit DW_AT_upper_bound when the upper bound is unknown.
> I think this code does not achieve that effect when the Count == -1:
>
> > -  addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
> > +  if (H > 0 || Count != 0)
> > +    addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
>
> And I don't see that the tests verify that you actually omit
> DW_AT_upper_bound for that case.
>
>
This test will have tested that:


> Modified: llvm/trunk/test/DebugInfo/array.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/array.ll?rev=169218&r1=169217&r2=169218&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/array.ll (original)
> +++ llvm/trunk/test/DebugInfo/array.ll Tue Dec  4 00:20:49 2012
> @@ -29,6 +29,6 @@
>  ;CHECK-NOT: DW_AT_lower_bound
>  ;CHECK-NOT: DW_AT_upper_bound
>  ;CHECK-NEXT: End Of Children Mark
> -!10 = metadata !{i32 589857, i64 1, i64 0}        ; [
> DW_TAG_subrange_type ]
> +!10 = metadata !{i32 589857, i64 1, i64 0, i64 -1}        ; [
> DW_TAG_subrange_type ]
>  !11 = metadata !{i32 4, i32 7, metadata !7, null}
>  !12 = metadata !{i32 5, i32 3, metadata !7, null}
>

 and something similar here:

int a (int b) {
  int c[b];
  return c[b-1];
}

does not, in fact, have an upper bound or count:

0x00000066:       DW_TAG_variable [5]
0x00000067:         DW_AT_name [DW_FORM_strp]   ( .debug_str[0x0000006f] =
"c")
0x0000006b:         DW_AT_decl_file [DW_FORM_data1]     (0x01)
0x0000006c:         DW_AT_decl_line [DW_FORM_data1]     (0x02)
0x0000006d:         DW_AT_type [DW_FORM_ref4]   (cu + 0x0081 =>
{0x00000081})
0x00000071:         DW_AT_location [DW_FORM_data4]      (0x00000000)

0x00000075:       NULL

0x00000076:     NULL

0x00000077:   DW_TAG_base_type [6]
0x00000078:     DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000069] =
"int")
0x0000007c:     DW_AT_encoding [DW_FORM_data1]  (0x05)
0x0000007d:     DW_AT_byte_size [DW_FORM_data1] (0x04)

0x0000007e:   DW_TAG_base_type [7]
0x0000007f:     DW_AT_byte_size [DW_FORM_data1] (0x04)
0x00000080:     DW_AT_encoding [DW_FORM_data1]  (0x05)

0x00000081:   DW_TAG_array_type [8] *
0x00000082:     DW_AT_type [DW_FORM_ref4]       (cu + 0x0077 =>
{0x00000077})

0x00000086:     DW_TAG_subrange_type [9]
0x00000087:       DW_AT_type [DW_FORM_ref4]     (cu + 0x007e =>
{0x0000007e})

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121204/531bf698/attachment.html>


More information about the llvm-commits mailing list