summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-10 22:17:37 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-10 22:17:37 +0000
commit670b32abef68deb992b7d74a5a0711a5da8466fa (patch)
treec3a36f44db116111b006f663717fd9c66d1d81e5 /gcc/dwarf2out.c
parent28d5c3d93ab64606c9c4bf18bb17383160508ce0 (diff)
downloadgcc-670b32abef68deb992b7d74a5a0711a5da8466fa.tar.gz
* dwarf2out.c (add_byte_size_attribute) <RECORD_TYPE>: Handle variable
reference as size attribute. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187384 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7460bbf670e..1e5e335cdb3 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: