(layout_record...

(layout_record, PCC_BITFIELD_TYPE_MATTERS): Only add padding if a bit
field would otherwise span more units of alignment than its base type.

From-SVN: r13727
This commit is contained in:
Richard Kenner 1997-03-17 17:13:37 -05:00
parent 7c4033ff87
commit 0b364e61d3
1 changed files with 5 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* C-compiler utilities for types and variables storage layout
Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
Copyright (C) 1987, 88, 92-96, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -438,14 +438,10 @@ layout_record (rec)
register tree dsize = DECL_SIZE (field);
int field_size = TREE_INT_CST_LOW (dsize);
/* A bit field may not span the unit of alignment of its type.
Advance to next boundary if necessary. */
/* ??? There is some uncertainty here as to what
should be done if type_align is less than the width of the type.
That can happen because the width exceeds BIGGEST_ALIGNMENT
or because it exceeds maximum_field_alignment. */
if (const_size / type_align
!= (const_size + MIN (field_size, type_align) - 1) / type_align)
/* A bit field may not span more units of alignment of its type
than its type itself. Advance to next boundary if necessary. */
if ((const_size / type_align - (const_size + field_size) / type_align)
> TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field))) / type_align)
const_size = CEIL (const_size, type_align) * type_align;
}
#endif