]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ada/35998 (debug info invalid x86_64 DW_AT_byte_size 0xffffffff)
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 13 Nov 2013 10:07:14 +0000 (10:07 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 13 Nov 2013 10:07:14 +0000 (10:07 +0000)
PR ada/35998
* dwarf2out.c (add_byte_size_attribute): Also use int_size_in_bytes
for fields.  Do not add the attribute if the size is negative.

From-SVN: r204736

gcc/ChangeLog
gcc/dwarf2out.c

index 28e44407330d9d6a4aaf130ba8e7b6aa8bf326c6..7e7f3ea385074882db5655d275acc4ec1b328de9 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-13  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ada/35998
+       * dwarf2out.c (add_byte_size_attribute): Also use int_size_in_bytes
+       for fields.  Do not add the attribute if the size is negative.
+
 2013-11-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/arm.c: Include aarch-cost-tables.h.
index d661bd7076cd9bfae53bd9edd8060fe575b7afca..3822a652d80c0ad0e6c3f5d96172c7f31e093eee 100644 (file)
@@ -16318,11 +16318,13 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
     }
 }
 
+/* Add a DW_AT_byte_size attribute to DIE with TREE_NODE's size.  */
+
 static void
 add_byte_size_attribute (dw_die_ref die, tree tree_node)
 {
   dw_die_ref decl_die;
-  unsigned size;
+  HOST_WIDE_INT size;
 
   switch (TREE_CODE (tree_node))
     {
@@ -16346,7 +16348,7 @@ add_byte_size_attribute (dw_die_ref die, tree tree_node)
         generally given as the number of bytes normally allocated for an
         object of the *declared* type of the member itself.  This is true
         even for bit-fields.  */
-      size = simple_type_size_in_bits (field_type (tree_node)) / BITS_PER_UNIT;
+      size = int_size_in_bytes (field_type (tree_node));
       break;
     default:
       gcc_unreachable ();
@@ -16355,8 +16357,9 @@ add_byte_size_attribute (dw_die_ref die, tree tree_node)
   /* Note that `size' might be -1 when we get to this point.  If it is, that
      indicates that the byte size of the entity in question is variable.  We
      have no good way of expressing this fact in Dwarf at the present time,
-     so just let the -1 pass on through.  */
-  add_AT_unsigned (die, DW_AT_byte_size, size);
+     when location description was not used by the caller code instead.  */
+  if (size >= 0)
+    add_AT_unsigned (die, DW_AT_byte_size, size);
 }
 
 /* For a FIELD_DECL node which represents a bit-field, output an attribute