]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (field_byte_offset): Use the type size as the field size if the latter...
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 17 Apr 2009 20:42:16 +0000 (20:42 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 17 Apr 2009 20:42:16 +0000 (20:42 +0000)
* dwarf2out.c (field_byte_offset): Use the type size as the field size
if the latter is not constant.

From-SVN: r146291

gcc/ChangeLog
gcc/dwarf2out.c

index a9cd06f0d4e35854bd649227a692523cebc98b80..7134327f1294b0a30b0754f67b962f0da21009ff 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-17  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * dwarf2out.c (field_byte_offset): Use the type size as the field size
+       if the latter is not constant.
+
 2009-04-17  David Edelsohn  <edelsohn@gnu.org>
 
        * dbxout.c (xcoff_debug_hooks): Add set_name_debug_nothing.
index 81a5062fc204477d917bc095378e03d4a39cc63b..d4799b163b53440f92bf026462a4e0e1d5e6d345 100644 (file)
@@ -10900,21 +10900,22 @@ field_byte_offset (const_tree decl)
       unsigned HOST_WIDE_INT type_size_in_bits;
 
       type = field_type (decl);
+      type_size_in_bits = simple_type_size_in_bits (type);
+      type_align_in_bits = simple_type_align_in_bits (type);
+
       field_size_tree = DECL_SIZE (decl);
 
       /* The size could be unspecified if there was an error, or for
          a flexible array member.  */
-      if (! field_size_tree)
+      if (!field_size_tree)
         field_size_tree = bitsize_zero_node;
 
-      /* If we don't know the size of the field, pretend it's a full word.  */
+      /* If the size of the field is not constant, use the type size.  */
       if (host_integerp (field_size_tree, 1))
         field_size_in_bits = tree_low_cst (field_size_tree, 1);
       else
-        field_size_in_bits = BITS_PER_WORD;
+        field_size_in_bits = type_size_in_bits;
 
-      type_size_in_bits = simple_type_size_in_bits (type);
-      type_align_in_bits = simple_type_align_in_bits (type);
       decl_align_in_bits = simple_decl_align_in_bits (decl);
 
       /* The GCC front-end doesn't make any attempt to keep track of the