aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-10-19 03:06:44 +0000
committerRichard Stallman <rms@gnu.org>1993-10-19 03:06:44 +0000
commit88687ce983a9e7b6266ae27e3f0a1e782dcdcc8e (patch)
tree4b6d733eceadccd14413e67d1b1ef5546cff6722
parentdfa90b42711bf544de3c4cd45c795446de12d454 (diff)
downloadgcc-88687ce983a9e7b6266ae27e3f0a1e782dcdcc8e.zip
gcc-88687ce983a9e7b6266ae27e3f0a1e782dcdcc8e.tar.gz
gcc-88687ce983a9e7b6266ae27e3f0a1e782dcdcc8e.tar.bz2
(process_init_element): Align structure elements that are subaggregates.
From-SVN: r5798
-rw-r--r--gcc/c-typeck.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 189f3bc..cea82f3 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -5828,6 +5828,23 @@ process_init_element (value)
&& (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
|| fieldcode == UNION_TYPE))
{
+ /* Structure elements may require alignment. Do this now
+ if necessary for the subaggregate. */
+ if (constructor_incremental)
+ {
+ /* Advance to offset of this element. */
+ if (! tree_int_cst_equal (constructor_bit_index,
+ DECL_FIELD_BITPOS (constructor_fields)))
+ {
+ int next = (TREE_INT_CST_LOW
+ (DECL_FIELD_BITPOS (constructor_fields))
+ / BITS_PER_UNIT);
+ int here = (TREE_INT_CST_LOW (constructor_bit_index)
+ / BITS_PER_UNIT);
+
+ assemble_zeros (next - here);
+ }
+ }
push_init_level (1);
continue;
}