Commit c163d21d by Jakub Jelinek Committed by Jakub Jelinek

stor-layout.c (place_union_field): If any field was aligned with attribute…

stor-layout.c (place_union_field): If any field was aligned with attribute aligned, set record type's TYPE_USER_ALIGN.

	* stor-layout.c (place_union_field): If any field was aligned with
	attribute aligned, set record type's TYPE_USER_ALIGN.
	(place_field): Likewise.
	(finalize_record_size): Don't clear TYPE_USER_ALIGN.
	(layout_type) [ARRAY_TYPE]: Copy element's TYPE_USER_ALIGN.

From-SVN: r46475
parent 6dee3a23
2001-10-24 Jakub Jelinek <jakub@redhat.com>
* stor-layout.c (place_union_field): If any field was aligned with
attribute aligned, set record type's TYPE_USER_ALIGN.
(place_field): Likewise.
(finalize_record_size): Don't clear TYPE_USER_ALIGN.
(layout_type) [ARRAY_TYPE]: Copy element's TYPE_USER_ALIGN.
2001-10-24 Zack Weinberg <zack@codesourcery.com> 2001-10-24 Zack Weinberg <zack@codesourcery.com>
* c-common.h (struct c_common_identifier): Remove rid_code field. * c-common.h (struct c_common_identifier): Remove rid_code field.
......
...@@ -650,6 +650,8 @@ place_union_field (rli, field) ...@@ -650,6 +650,8 @@ place_union_field (rli, field)
MIN (desired_align, (unsigned) BIGGEST_FIELD_ALIGNMENT); MIN (desired_align, (unsigned) BIGGEST_FIELD_ALIGNMENT);
#endif #endif
TYPE_USER_ALIGN (rli->t) |= DECL_USER_ALIGN (field);
/* Union must be at least as aligned as any field requires. */ /* Union must be at least as aligned as any field requires. */
rli->record_align = MAX (rli->record_align, desired_align); rli->record_align = MAX (rli->record_align, desired_align);
rli->unpadded_align = MAX (rli->unpadded_align, desired_align); rli->unpadded_align = MAX (rli->unpadded_align, desired_align);
...@@ -924,6 +926,8 @@ place_field (rli, field) ...@@ -924,6 +926,8 @@ place_field (rli, field)
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos; DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
SET_DECL_OFFSET_ALIGN (field, rli->offset_align); SET_DECL_OFFSET_ALIGN (field, rli->offset_align);
TYPE_USER_ALIGN (rli->t) |= user_align;
/* If this field ended up more aligned than we thought it would be (we /* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field approximate this by seeing if its position changed), lay out the field
again; perhaps we can use an integral mode for it now. */ again; perhaps we can use an integral mode for it now. */
...@@ -993,7 +997,6 @@ finalize_record_size (rli) ...@@ -993,7 +997,6 @@ finalize_record_size (rli)
#else #else
TYPE_ALIGN (rli->t) = MAX (TYPE_ALIGN (rli->t), rli->record_align); TYPE_ALIGN (rli->t) = MAX (TYPE_ALIGN (rli->t), rli->record_align);
#endif #endif
TYPE_USER_ALIGN (rli->t) = 0;
/* Compute the size so far. Be sure to allow for extra bits in the /* Compute the size so far. Be sure to allow for extra bits in the
size in bytes. We have guaranteed above that it will be no more size in bytes. We have guaranteed above that it will be no more
...@@ -1454,6 +1457,7 @@ layout_type (type) ...@@ -1454,6 +1457,7 @@ layout_type (type)
#else #else
TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT); TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
#endif #endif
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (element);
#ifdef ROUND_TYPE_SIZE #ifdef ROUND_TYPE_SIZE
if (TYPE_SIZE (type) != 0) if (TYPE_SIZE (type) != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment