diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1997-03-17 17:13:37 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1997-03-17 17:13:37 -0500 |
commit | 0b364e61d36fde678b4b7abba497f0569a0ee48a (patch) | |
tree | 2c90b20fd92293bc4e428f9504d956c665ea87f5 | |
parent | 7c4033ff873eff676305c71bd6f983f74cad53b4 (diff) | |
download | gcc-0b364e61d36fde678b4b7abba497f0569a0ee48a.zip gcc-0b364e61d36fde678b4b7abba497f0569a0ee48a.tar.gz gcc-0b364e61d36fde678b4b7abba497f0569a0ee48a.tar.bz2 |
(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
-rw-r--r-- | gcc/stor-layout.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index e014e47..98f5596 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -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 |