From: ebotcazou Date: Thu, 10 May 2012 22:17:37 +0000 (+0000) Subject: * dwarf2out.c (add_byte_size_attribute) : Handle variable X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=670b32abef68deb992b7d74a5a0711a5da8466fa;p=thirdparty%2Fgcc.git * dwarf2out.c (add_byte_size_attribute) : Handle variable reference as size attribute. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187384 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 856c6756ea96..2a278351673f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-05-10 Eric Botcazou + + * dwarf2out.c (add_byte_size_attribute) : Handle variable + reference as size attribute. + 2012-05-10 Eric Botcazou Tristan Gingold diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7460bbf670e4..1e5e335cdb30 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -15156,6 +15156,7 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p) static void add_byte_size_attribute (dw_die_ref die, tree tree_node) { + dw_die_ref decl_die; unsigned size; switch (TREE_CODE (tree_node)) @@ -15167,6 +15168,12 @@ add_byte_size_attribute (dw_die_ref die, tree tree_node) case RECORD_TYPE: case UNION_TYPE: case QUAL_UNION_TYPE: + if (TREE_CODE (TYPE_SIZE_UNIT (tree_node)) == VAR_DECL + && (decl_die = lookup_decl_die (TYPE_SIZE_UNIT (tree_node)))) + { + add_AT_die_ref (die, DW_AT_byte_size, decl_die); + return; + } size = int_size_in_bytes (tree_node); break; case FIELD_DECL: