<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 4, 2012 at 1:18 PM, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul.Robinson@am.sony.com" target="_blank">Paul.Robinson@am.sony.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">So, you're adding a count to the metadata, but not emitting DW_AT_count?<br>

Am I understanding that correctly?  And a metadata count == -1 means you<br>
have an unknown upper bound?<br>
<br>
DWARF wants you to omit DW_AT_upper_bound when the upper bound is unknown.<br>
I think this code does not achieve that effect when the Count == -1:<br>
<div class="im"><br>
> -  addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);<br>
> +  if (H > 0 || Count != 0)<br>
> +    addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);<br>
<br>
</div>And I don't see that the tests verify that you actually omit<br>
DW_AT_upper_bound for that case.<br><div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>This test will have tested that:</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
Modified: llvm/trunk/test/DebugInfo/array.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/array.ll?rev=169218&r1=169217&r2=169218&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/array.ll?rev=169218&r1=169217&r2=169218&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/test/DebugInfo/array.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/array.ll Tue Dec  4 00:20:49 2012<br>
@@ -29,6 +29,6 @@<br>
 ;CHECK-NOT: DW_AT_lower_bound<br>
 ;CHECK-NOT: DW_AT_upper_bound<br>
 ;CHECK-NEXT: End Of Children Mark<br>
-!10 = metadata !{i32 589857, i64 1, i64 0}        ; [ DW_TAG_subrange_type ]<br>
+!10 = metadata !{i32 589857, i64 1, i64 0, i64 -1}        ; [ DW_TAG_subrange_type ]<br>
 !11 = metadata !{i32 4, i32 7, metadata !7, null}<br>
 !12 = metadata !{i32 5, i32 3, metadata !7, null}<br></div></div></blockquote><div><br></div><div> and something similar here:</div><div><br></div><div><div>int a (int b) {</div><div>  int c[b];</div><div>  return c[b-1];</div>
<div>}</div></div><div><br></div><div>does not, in fact, have an upper bound or count:</div><div><br></div><div><div>0x00000066:       DW_TAG_variable [5]  </div><div>0x00000067:         DW_AT_name [DW_FORM_strp]   ( .debug_str[0x0000006f] = "c")</div>
<div>0x0000006b:         DW_AT_decl_file [DW_FORM_data1]     (0x01)</div><div>0x0000006c:         DW_AT_decl_line [DW_FORM_data1]     (0x02)</div><div>0x0000006d:         DW_AT_type [DW_FORM_ref4]   (cu + 0x0081 => {0x00000081})</div>
<div>0x00000071:         DW_AT_location [DW_FORM_data4]      (0x00000000)</div><div><br></div><div>0x00000075:       NULL</div><div><br></div><div>0x00000076:     NULL</div><div><br></div><div>0x00000077:   DW_TAG_base_type [6]  </div>
<div>0x00000078:     DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000069] = "int")</div><div>0x0000007c:     DW_AT_encoding [DW_FORM_data1]  (0x05)</div><div>0x0000007d:     DW_AT_byte_size [DW_FORM_data1] (0x04)</div>
<div><br></div><div>0x0000007e:   DW_TAG_base_type [7]  </div><div>0x0000007f:     DW_AT_byte_size [DW_FORM_data1] (0x04)</div><div>0x00000080:     DW_AT_encoding [DW_FORM_data1]  (0x05)</div><div><br></div><div>0x00000081:   DW_TAG_array_type [8] *</div>
<div>0x00000082:     DW_AT_type [DW_FORM_ref4]       (cu + 0x0077 => {0x00000077})</div><div><br></div><div>0x00000086:     DW_TAG_subrange_type [9]  </div><div>0x00000087:       DW_AT_type [DW_FORM_ref4]     (cu + 0x007e => {0x0000007e})</div>
<div><br></div></div><div>-eric</div></div></div>