aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-04-17 20:42:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-17 20:42:16 +0000
commit9eacf7a62a6c26d070718471112637a4400f9859 (patch)
tree6dc2d8b558da04f44d80b6634d9ce57993de60e7 /gcc
parent5829817786ab80da86c0d3a0a6b97bb653e71530 (diff)
downloadgcc-9eacf7a62a6c26d070718471112637a4400f9859.zip
gcc-9eacf7a62a6c26d070718471112637a4400f9859.tar.gz
gcc-9eacf7a62a6c26d070718471112637a4400f9859.tar.bz2
dwarf2out.c (field_byte_offset): Use the type size as the field size if the latter is not constant.
* dwarf2out.c (field_byte_offset): Use the type size as the field size if the latter is not constant. From-SVN: r146291
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/dwarf2out.c11
2 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a9cd06f..7134327 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 81a5062..d4799b1 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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