From 2e25f3a6c57335cba50111faceb0ce2ab59e9bcb Mon Sep 17 00:00:00 2001 From: kan Date: Sun, 1 Sep 2002 20:38:57 +0000 Subject: Gcc 3.2.1-prerelease from the FSF anoncvs repo gcc-3_2-branch on 1-Sep-2002 00:00:01 EDT. --- contrib/gcc/stor-layout.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'contrib/gcc/stor-layout.c') diff --git a/contrib/gcc/stor-layout.c b/contrib/gcc/stor-layout.c index 2db4675..c330fb6 100644 --- a/contrib/gcc/stor-layout.c +++ b/contrib/gcc/stor-layout.c @@ -669,7 +669,8 @@ place_union_field (rli, field) #endif #ifdef ADJUST_FIELD_ALIGN - desired_align = ADJUST_FIELD_ALIGN (field, desired_align); + if (! DECL_USER_ALIGN (field)) + desired_align = ADJUST_FIELD_ALIGN (field, desired_align); #endif TYPE_USER_ALIGN (rli->t) |= DECL_USER_ALIGN (field); @@ -683,10 +684,15 @@ place_union_field (rli, field) entire union to have `int' alignment. */ if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field)) { - rli->record_align = MAX (rli->record_align, - TYPE_ALIGN (TREE_TYPE (field))); - rli->unpadded_align = MAX (rli->unpadded_align, - TYPE_ALIGN (TREE_TYPE (field))); + unsigned int type_align = TYPE_ALIGN (TREE_TYPE (field)); + +#ifdef ADJUST_FIELD_ALIGN + if (! TYPE_USER_ALIGN (TREE_TYPE (field))) + type_align = ADJUST_FIELD_ALIGN (field, type_align); +#endif + rli->record_align = MAX (rli->record_align, type_align); + rli->unpadded_align = MAX (rli->unpadded_align, type_align); + TYPE_USER_ALIGN (rli->t) |= TYPE_USER_ALIGN (TREE_TYPE (field)); } #endif @@ -783,7 +789,8 @@ place_field (rli, field) #endif #ifdef ADJUST_FIELD_ALIGN - desired_align = ADJUST_FIELD_ALIGN (field, desired_align); + if (! user_align) + desired_align = ADJUST_FIELD_ALIGN (field, desired_align); #endif /* Record must have at least as much alignment as any field. @@ -827,6 +834,11 @@ place_field (rli, field) { unsigned int type_align = TYPE_ALIGN (type); +#ifdef ADJUST_FIELD_ALIGN + if (! TYPE_USER_ALIGN (type)) + type_align = ADJUST_FIELD_ALIGN (field, type_align); +#endif + if (maximum_field_alignment != 0) type_align = MIN (type_align, maximum_field_alignment); else if (DECL_PACKED (field)) @@ -836,6 +848,7 @@ place_field (rli, field) rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field)); if (warn_packed) rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type)); + user_align |= TYPE_USER_ALIGN (type); } } else @@ -915,6 +928,11 @@ place_field (rli, field) HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0); HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0); +#ifdef ADJUST_FIELD_ALIGN + if (! TYPE_USER_ALIGN (type)) + type_align = ADJUST_FIELD_ALIGN (field, type_align); +#endif + /* A bit field may not span more units of alignment of its type than its type itself. Advance to next boundary if necessary. */ if ((((offset * BITS_PER_UNIT + bit_offset + field_size + @@ -923,6 +941,8 @@ place_field (rli, field) - (offset * BITS_PER_UNIT + bit_offset) / type_align) > tree_low_cst (TYPE_SIZE (type), 1) / type_align) rli->bitpos = round_up (rli->bitpos, type_align); + + user_align |= TYPE_USER_ALIGN (type); } #endif @@ -944,6 +964,11 @@ place_field (rli, field) HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0); HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0); +#ifdef ADJUST_FIELD_ALIGN + if (! TYPE_USER_ALIGN (type)) + type_align = ADJUST_FIELD_ALIGN (field, type_align); +#endif + if (maximum_field_alignment != 0) type_align = MIN (type_align, maximum_field_alignment); /* ??? This test is opposite the test in the containing if @@ -959,6 +984,8 @@ place_field (rli, field) != ((offset * BITS_PER_UNIT + bit_offset + field_size - 1) / type_align)) rli->bitpos = round_up (rli->bitpos, type_align); + + user_align |= TYPE_USER_ALIGN (type); } #endif -- cgit v1.1