1
0
mirror of https://github.com/golang/go synced 2024-11-20 05:04:43 -07:00

cmd/ld: generate correct upper bound value for array types.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/115820043
This commit is contained in:
Rob Pike 2014-07-15 01:38:05 +00:00
parent fd7b82b4e4
commit 79b106ec62
2 changed files with 3 additions and 2 deletions

View File

@ -104,7 +104,7 @@ decodetype_arrayelem(LSym *s)
vlong
decodetype_arraylen(LSym *s)
{
return decode_inuxi(s->p + commonsize()+PtrSize, PtrSize);
return decode_inuxi(s->p + commonsize()+2*PtrSize, PtrSize);
}
// Type.PtrType.elem
@ -120,6 +120,7 @@ decodetype_mapkey(LSym *s)
{
return decode_reloc_sym(s, commonsize()); // 0x1c / 0x30
}
LSym*
decodetype_mapvalue(LSym *s)
{

View File

@ -992,7 +992,7 @@ defgotype(LSym *gotype)
s = decodetype_arrayelem(gotype);
newrefattr(die, DW_AT_type, defgotype(s));
fld = newdie(die, DW_ABRV_ARRAYRANGE, "range");
newattr(fld, DW_AT_upper_bound, DW_CLS_CONSTANT, decodetype_arraylen(gotype), 0);
newattr(fld, DW_AT_upper_bound, DW_CLS_CONSTANT, decodetype_arraylen(gotype)-1, 0); // -1: want upper bound, not count.
newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"));
break;