]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* dwarf2out.c (add_byte_size_attribute) <RECORD_TYPE>: Handle variable
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 22:17:37 +0000 (22:17 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 22:17:37 +0000 (22:17 +0000)
reference as size attribute.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187384 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c

index 856c6756ea960d06c99904447a88cb59354b28c7..2a278351673fb5a356df560ff2001fd0e27ffd0c 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * dwarf2out.c (add_byte_size_attribute) <RECORD_TYPE>: Handle variable
+       reference as size attribute.
+
 2012-05-10  Eric Botcazou  <ebotcazou@adacore.com>
            Tristan Gingold  <gingold@adacore.com>
 
index 7460bbf670e44120877df85874fc48ab5543a6cb..1e5e335cdb30368aafec73160f3bba56e82deb8b 100644 (file)
@@ -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: