This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
field alignment reorg PATCH
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 03 Apr 2003 13:17:29 -0500
- Subject: field alignment reorg PATCH
While I was looking at java/10145, it seemed to me that a lot of the reason
for the breakage was spreading the logic for determining what alignment a
field wants through so many different functions. This patch tries to
improve this by moving it all into layout_decl. Hopefully this will
improve its maintainability.
Tested i686-pc-linux-gnu, applied to trunk. No testcase; the bug in
question was fixed by my earlier minimal patch.
2003-03-25 Jason Merrill <jason at redhat dot com>
* stor-layout.c (do_type_align): New fn, split out from...
(layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
* tree.h (struct record_layout_info_s): Remove unpadded_align.
* c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
or DECL_MODE on the CONST_DECLs.
(finish_struct): Don't mess with DECL_ALIGN.
* cp/class.c (build_vtable): Set DECL_ALIGN here.
(get_vtable_decl): Not here.
(layout_vtable_decl): Or here.
(create_vtable_ptr): Or here.
(layout_class_type): Or here.
(check_bitfield_decl): Don't mess with field alignment.
* ada/misc.c (gnat_adjust_rli): #if 0.
*** ./gcc/cp/class.c.~1~ 2003-03-31 15:26:29.000000000 -0500
--- ./gcc/cp/class.c 2003-03-31 15:25:17.000000000 -0500
*************** build_vtable (tree class_type, tree name
*** 531,536 ****
--- 531,541 ----
DECL_VIRTUAL_P (decl) = 1;
DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
+ /* At one time the vtable info was grabbed 2 words at a time. This
+ fails on sparc unless you have 8-byte alignment. (tiemann) */
+ DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
+ DECL_ALIGN (decl));
+
import_export_vtable (decl, class_type, 0);
return decl;
*************** get_vtable_decl (tree type, int complete
*** 553,563 ****
decl = build_vtable (type, get_vtable_name (type), vtbl_type_node);
CLASSTYPE_VTABLES (type) = decl;
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on sparc unless you have 8-byte alignment. (tiemann) */
- DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (decl));
-
if (complete)
{
DECL_EXTERNAL (decl) = 1;
--- 558,563 ----
*************** layout_vtable_decl (tree binfo, int n)
*** 2017,2027 ****
TREE_TYPE (vtable) = atype;
DECL_SIZE (vtable) = DECL_SIZE_UNIT (vtable) = NULL_TREE;
layout_decl (vtable, 0);
-
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on SPARC unless you have 8-byte alignment. */
- DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (vtable));
}
}
--- 2017,2022 ----
*************** check_bitfield_decl (tree field)
*** 2952,2982 ****
{
DECL_SIZE (field) = convert (bitsizetype, w);
DECL_BIT_FIELD (field) = 1;
-
- if (integer_zerop (w)
- && ! (* targetm.ms_bitfield_layout_p) (DECL_FIELD_CONTEXT (field)))
- {
- #ifdef EMPTY_FIELD_BOUNDARY
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
- EMPTY_FIELD_BOUNDARY);
- #endif
- #ifdef PCC_BITFIELD_TYPE_MATTERS
- if (PCC_BITFIELD_TYPE_MATTERS)
- {
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
- TYPE_ALIGN (type));
- DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
- }
- #endif
- }
}
else
{
/* Non-bit-fields are aligned for their type. */
DECL_BIT_FIELD (field) = 0;
CLEAR_DECL_C_BIT_FIELD (field);
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field), TYPE_ALIGN (type));
- DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
}
}
--- 2947,2958 ----
*************** create_vtable_ptr (tree t, tree* virtual
*** 4428,4435 ****
DECL_ARTIFICIAL (field) = 1;
DECL_FIELD_CONTEXT (field) = t;
DECL_FCONTEXT (field) = t;
- DECL_ALIGN (field) = TYPE_ALIGN (vtbl_ptr_type_node);
- DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (vtbl_ptr_type_node);
TYPE_VFIELD (t) = field;
--- 4404,4409 ----
*************** layout_class_type (tree t, tree *virtual
*** 4950,4957 ****
char_type_node);
DECL_BIT_FIELD (padding_field) = 1;
DECL_SIZE (padding_field) = padding;
- DECL_ALIGN (padding_field) = 1;
- DECL_USER_ALIGN (padding_field) = 0;
layout_nonempty_base_or_field (rli, padding_field,
NULL_TREE,
empty_base_offsets);
--- 4924,4929 ----
*** ./gcc/ada/misc.c.~1~ 2003-03-31 15:26:29.000000000 -0500
--- ./gcc/ada/misc.c 2003-04-03 00:01:39.000000000 -0500
*************** gnat_expand_expr (exp, target, tmode, mo
*** 563,570 ****
static void
gnat_adjust_rli (rli)
! record_layout_info rli;
{
unsigned int record_align = rli->unpadded_align;
tree field;
--- 563,573 ----
static void
gnat_adjust_rli (rli)
! record_layout_info rli ATTRIBUTE_UNUSED;
{
+ #if 0
+ /* This code seems to have no actual effect; record_align should already
+ reflect the largest alignment desired by a field. jason 2003-04-01 */
unsigned int record_align = rli->unpadded_align;
tree field;
*************** gnat_adjust_rli (rli)
*** 576,581 ****
--- 579,585 ----
if (TYPE_PACKED (rli->t))
rli->record_align = record_align;
+ #endif
}
/* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */
*** ./gcc/c-decl.c.~1~ 2003-03-31 15:26:28.000000000 -0500
--- ./gcc/c-decl.c 2003-03-31 15:25:08.000000000 -0500
*************** finish_struct (t, fieldlist, attributes)
*** 5237,5259 ****
DECL_SIZE (x) = bitsize_int (width);
DECL_BIT_FIELD (x) = 1;
SET_DECL_C_BIT_FIELD (x);
-
- if (width == 0
- && ! (* targetm.ms_bitfield_layout_p) (t))
- {
- /* field size 0 => force desired amount of alignment. */
- #ifdef EMPTY_FIELD_BOUNDARY
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
- #endif
- #ifdef PCC_BITFIELD_TYPE_MATTERS
- if (PCC_BITFIELD_TYPE_MATTERS)
- {
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
- TYPE_ALIGN (TREE_TYPE (x)));
- DECL_USER_ALIGN (x) |= TYPE_USER_ALIGN (TREE_TYPE (x));
- }
- #endif
- }
}
}
--- 5237,5242 ----
*************** finish_enum (enumtype, values, attribute
*** 5551,5561 ****
tree enu = TREE_PURPOSE (pair);
TREE_TYPE (enu) = enumtype;
- DECL_SIZE (enu) = TYPE_SIZE (enumtype);
- DECL_SIZE_UNIT (enu) = TYPE_SIZE_UNIT (enumtype);
- DECL_ALIGN (enu) = TYPE_ALIGN (enumtype);
- DECL_USER_ALIGN (enu) = TYPE_USER_ALIGN (enumtype);
- DECL_MODE (enu) = TYPE_MODE (enumtype);
/* The ISO C Standard mandates enumerators to have type int,
even though the underlying type of an enum type is
--- 5534,5539 ----
*** ./gcc/stor-layout.c.~1~ 2003-03-31 15:26:29.000000000 -0500
--- ./gcc/stor-layout.c 2003-04-03 00:27:29.000000000 -0500
*************** round_down (value, divisor)
*** 357,362 ****
--- 357,375 ----
return size_binop (MULT_EXPR, size_binop (FLOOR_DIV_EXPR, value, arg), arg);
}
+ /* Subroutine of layout_decl: Force alignment required for the data type.
+ But if the decl itself wants greater alignment, don't override that. */
+
+ static inline void
+ do_type_align (tree type, tree decl)
+ {
+ if (TYPE_ALIGN (type) > DECL_ALIGN (decl))
+ {
+ DECL_ALIGN (decl) = TYPE_ALIGN (type);
+ DECL_USER_ALIGN (decl) = TYPE_USER_ALIGN (type);
+ }
+ }
+
/* Set the size, mode and alignment of a ..._DECL node.
TYPE_DECL does need this for C++.
Note that LABEL_DECL and CONST_DECL nodes do not need this,
*************** layout_decl (decl, known_align)
*** 411,477 ****
= convert (sizetype, size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),
bitsize_unit_node));
! /* Force alignment required for the data type.
! But if the decl itself wants greater alignment, don't override that.
! Likewise, if the decl is packed, don't override it. */
! if (! (code == FIELD_DECL && DECL_BIT_FIELD (decl))
! && (DECL_ALIGN (decl) == 0
! || (! (code == FIELD_DECL && DECL_PACKED (decl))
! && TYPE_ALIGN (type) > DECL_ALIGN (decl))))
{
! DECL_ALIGN (decl) = TYPE_ALIGN (type);
! DECL_USER_ALIGN (decl) = 0;
! }
! /* For fields, set the bit field type and update the alignment. */
! if (code == FIELD_DECL)
! {
! DECL_BIT_FIELD_TYPE (decl) = DECL_BIT_FIELD (decl) ? type : 0;
! if (maximum_field_alignment != 0)
! DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
/* If the field is of variable size, we can't misalign it since we
have no way to make a temporary to align the result. But this
isn't an issue if the decl is not addressable. Likewise if it
is of unknown size. */
! else if (DECL_PACKED (decl)
! && (DECL_NONADDRESSABLE_P (decl)
! || DECL_SIZE_UNIT (decl) == 0
! || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
! {
! DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
! DECL_USER_ALIGN (decl) = 0;
! }
! }
! /* See if we can use an ordinary integer mode for a bit-field.
! Conditions are: a fixed size that is correct for another mode
! and occupying a complete byte or bytes on proper boundary. */
! if (code == FIELD_DECL && DECL_BIT_FIELD (decl)
! && TYPE_SIZE (type) != 0
! && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
! && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
! {
! enum machine_mode xmode
! = mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
!
! if (xmode != BLKmode && known_align >= GET_MODE_ALIGNMENT (xmode))
{
! DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
! DECL_ALIGN (decl));
! DECL_MODE (decl) = xmode;
! DECL_BIT_FIELD (decl) = 0;
}
}
- /* Turn off DECL_BIT_FIELD if we won't need it set. */
- if (code == FIELD_DECL && DECL_BIT_FIELD (decl)
- && TYPE_MODE (type) == BLKmode && DECL_MODE (decl) == BLKmode
- && known_align >= TYPE_ALIGN (type)
- && DECL_ALIGN (decl) >= TYPE_ALIGN (type)
- && DECL_SIZE_UNIT (decl) != 0)
- DECL_BIT_FIELD (decl) = 0;
-
/* Evaluate nonconstant size only once, either now or as soon as safe. */
if (DECL_SIZE (decl) != 0 && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
DECL_SIZE (decl) = variable_size (DECL_SIZE (decl));
--- 424,519 ----
= convert (sizetype, size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),
bitsize_unit_node));
! if (code != FIELD_DECL)
! /* For non-fields, update the alignment from the type. */
! do_type_align (type, decl);
! else
! /* For fields, it's a bit more complicated... */
{
! if (DECL_BIT_FIELD (decl))
! {
! DECL_BIT_FIELD_TYPE (decl) = type;
! /* A zero-length bit-field affects the alignment of the next
! field. */
! if (integer_zerop (DECL_SIZE (decl))
! && ! DECL_PACKED (decl)
! && ! (*targetm.ms_bitfield_layout_p) (DECL_FIELD_CONTEXT (decl)))
! {
! #ifdef PCC_BITFIELD_TYPE_MATTERS
! if (PCC_BITFIELD_TYPE_MATTERS)
! do_type_align (type, decl);
! else
! #endif
! #ifdef EMPTY_FIELD_BOUNDARY
! if (EMPTY_FIELD_BOUNDARY > DECL_ALIGN (decl))
! {
! DECL_ALIGN (decl) = EMPTY_FIELD_BOUNDARY;
! DECL_USER_ALIGN (decl) = 0;
! }
! #endif
! }
!
! /* See if we can use an ordinary integer mode for a bit-field.
! Conditions are: a fixed size that is correct for another mode
! and occupying a complete byte or bytes on proper boundary. */
! if (TYPE_SIZE (type) != 0
! && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
! && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
! {
! enum machine_mode xmode
! = mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
!
! if (xmode != BLKmode && known_align >= GET_MODE_ALIGNMENT (xmode))
! {
! DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
! DECL_ALIGN (decl));
! DECL_MODE (decl) = xmode;
! DECL_BIT_FIELD (decl) = 0;
! }
! }
!
! /* Turn off DECL_BIT_FIELD if we won't need it set. */
! if (TYPE_MODE (type) == BLKmode && DECL_MODE (decl) == BLKmode
! && known_align >= TYPE_ALIGN (type)
! && DECL_ALIGN (decl) >= TYPE_ALIGN (type))
! DECL_BIT_FIELD (decl) = 0;
! }
! else if (DECL_PACKED (decl) && DECL_USER_ALIGN (decl))
! /* Don't touch DECL_ALIGN. For other packed fields, go ahead and
! round up; we'll reduce it again below. */;
! else
! do_type_align (type, decl);
/* If the field is of variable size, we can't misalign it since we
have no way to make a temporary to align the result. But this
isn't an issue if the decl is not addressable. Likewise if it
is of unknown size. */
! if (DECL_PACKED (decl)
! && !DECL_USER_ALIGN (decl)
! && (DECL_NONADDRESSABLE_P (decl)
! || DECL_SIZE_UNIT (decl) == 0
! || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
! DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
! /* Should this be controlled by DECL_USER_ALIGN, too? */
! if (maximum_field_alignment != 0)
! DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
! if (! DECL_USER_ALIGN (decl))
{
! /* Some targets (i.e. i386, VMS) limit struct field alignment
! to a lower boundary than alignment of variables unless
! it was overridden by attribute aligned. */
! #ifdef BIGGEST_FIELD_ALIGNMENT
! DECL_ALIGN (decl)
! = MIN (DECL_ALIGN (decl), (unsigned) BIGGEST_FIELD_ALIGNMENT);
! #endif
! #ifdef ADJUST_FIELD_ALIGN
! DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl));
! #endif
}
}
/* Evaluate nonconstant size only once, either now or as soon as safe. */
if (DECL_SIZE (decl) != 0 && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
DECL_SIZE (decl) = variable_size (DECL_SIZE (decl));
*************** start_record_layout (t)
*** 532,538 ****
declaration, for example) use it -- otherwise, start with a
one-byte alignment. */
rli->record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (t));
! rli->unpacked_align = rli->unpadded_align = rli->record_align;
rli->offset_align = MAX (rli->record_align, BIGGEST_ALIGNMENT);
#ifdef STRUCTURE_SIZE_BOUNDARY
--- 574,580 ----
declaration, for example) use it -- otherwise, start with a
one-byte alignment. */
rli->record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (t));
! rli->unpacked_align = rli->record_align;
rli->offset_align = MAX (rli->record_align, BIGGEST_ALIGNMENT);
#ifdef STRUCTURE_SIZE_BOUNDARY
*************** debug_rli (rli)
*** 621,628 ****
print_node_brief (stderr, "\noffset", rli->offset, 0);
print_node_brief (stderr, " bitpos", rli->bitpos, 0);
! fprintf (stderr, "\naligns: rec = %u, unpack = %u, unpad = %u, off = %u\n",
! rli->record_align, rli->unpacked_align, rli->unpadded_align,
rli->offset_align);
if (rli->packed_maybe_necessary)
fprintf (stderr, "packed may be necessary\n");
--- 663,670 ----
print_node_brief (stderr, "\noffset", rli->offset, 0);
print_node_brief (stderr, " bitpos", rli->bitpos, 0);
! fprintf (stderr, "\naligns: rec = %u, unpack = %u, off = %u\n",
! rli->record_align, rli->unpacked_align,
rli->offset_align);
if (rli->packed_maybe_necessary)
fprintf (stderr, "packed may be necessary\n");
*************** update_alignment_for_field (rli, field,
*** 679,718 ****
tree type = TREE_TYPE (field);
/* True if the field was explicitly aligned by the user. */
bool user_align;
! /* Lay out the field so we know what alignment it needs. For a
! packed field, use the alignment as specified, disregarding what
! the type would want. */
desired_align = DECL_ALIGN (field);
user_align = DECL_USER_ALIGN (field);
- layout_decl (field, known_align);
- if (! DECL_PACKED (field))
- {
- desired_align = DECL_ALIGN (field);
- user_align = DECL_USER_ALIGN (field);
- }
-
- /* Some targets (i.e. i386, VMS) limit struct field alignment
- to a lower boundary than alignment of variables unless
- it was overridden by attribute aligned. */
- #ifdef BIGGEST_FIELD_ALIGNMENT
- if (!user_align)
- desired_align
- = MIN (desired_align, (unsigned) BIGGEST_FIELD_ALIGNMENT);
- #endif
! #ifdef ADJUST_FIELD_ALIGN
! if (!user_align)
! desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
! #endif
/* Record must have at least as much alignment as any field.
Otherwise, the alignment of the field within the record is
meaningless. */
! if ((* targetm.ms_bitfield_layout_p) (rli->t)
! && type != error_mark_node
! && DECL_BIT_FIELD_TYPE (field)
! && ! integer_zerop (TYPE_SIZE (type)))
{
/* Here, the alignment of the underlying type of a bitfield can
affect the alignment of a record; even a zero-sized field
--- 721,741 ----
tree type = TREE_TYPE (field);
/* True if the field was explicitly aligned by the user. */
bool user_align;
+ bool is_bitfield;
! /* Lay out the field so we know what alignment it needs. */
! layout_decl (field, known_align);
desired_align = DECL_ALIGN (field);
user_align = DECL_USER_ALIGN (field);
! is_bitfield = (type != error_mark_node
! && DECL_BIT_FIELD_TYPE (field)
! && ! integer_zerop (TYPE_SIZE (type)));
/* Record must have at least as much alignment as any field.
Otherwise, the alignment of the field within the record is
meaningless. */
! if (is_bitfield && (* targetm.ms_bitfield_layout_p) (rli->t))
{
/* Here, the alignment of the underlying type of a bitfield can
affect the alignment of a record; even a zero-sized field
*************** update_alignment_for_field (rli, field,
*** 732,760 ****
type_align = MIN (type_align, maximum_field_alignment);
rli->record_align = MAX (rli->record_align, type_align);
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
- rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field));
}
- else
- desired_align = 1;
}
- else
#ifdef PCC_BITFIELD_TYPE_MATTERS
! if (PCC_BITFIELD_TYPE_MATTERS && type != error_mark_node
! && ! (* targetm.ms_bitfield_layout_p) (rli->t)
! && DECL_BIT_FIELD_TYPE (field)
! && ! integer_zerop (TYPE_SIZE (type)))
{
- /* A zero-length bit-field affects the alignment of the next
- field. */
- if (!DECL_PACKED (field) && !user_align
- && integer_zerop (DECL_SIZE (field)))
- {
- desired_align = TYPE_ALIGN (type);
- #ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
- #endif
- }
-
/* Named bit-fields cause the entire structure to have the
alignment implied by their type. */
if (DECL_NAME (field) != 0)
--- 755,765 ----
type_align = MIN (type_align, maximum_field_alignment);
rli->record_align = MAX (rli->record_align, type_align);
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
}
}
#ifdef PCC_BITFIELD_TYPE_MATTERS
! else if (is_bitfield && PCC_BITFIELD_TYPE_MATTERS)
{
/* Named bit-fields cause the entire structure to have the
alignment implied by their type. */
if (DECL_NAME (field) != 0)
*************** update_alignment_for_field (rli, field,
*** 779,796 ****
rli->record_align = MAX (rli->record_align, desired_align);
rli->record_align = MAX (rli->record_align, type_align);
- 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
#endif
{
rli->record_align = MAX (rli->record_align, desired_align);
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
- rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field));
}
TYPE_USER_ALIGN (rli->t) |= user_align;
--- 784,799 ----
rli->record_align = MAX (rli->record_align, desired_align);
rli->record_align = MAX (rli->record_align, type_align);
if (warn_packed)
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
user_align |= TYPE_USER_ALIGN (type);
}
}
#endif
+ else
{
rli->record_align = MAX (rli->record_align, desired_align);
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
}
TYPE_USER_ALIGN (rli->t) |= user_align;
*************** place_field (rli, field)
*** 905,911 ****
if (warn_packed && DECL_PACKED (field))
{
! if (known_align > TYPE_ALIGN (type))
{
if (TYPE_ALIGN (type) > desired_align)
{
--- 908,914 ----
if (warn_packed && DECL_PACKED (field))
{
! if (known_align >= TYPE_ALIGN (type))
{
if (TYPE_ALIGN (type) > desired_align)
{
*** ./gcc/tree.h.~1~ 2003-03-31 15:26:29.000000000 -0500
--- ./gcc/tree.h 2003-04-03 00:30:18.000000000 -0500
*************** typedef struct record_layout_info_s
*** 2452,2462 ****
tree bitpos;
/* The alignment of the record so far, in bits. */
unsigned int record_align;
! /* The alignment of the record so far, not including padding, in bits. */
unsigned int unpacked_align;
- /* The alignment of the record so far, allowing for the record to be
- padded only at the end, in bits. */
- unsigned int unpadded_align;
/* The previous field layed out. */
tree prev_field;
/* The static variables (i.e., class variables, as opposed to
--- 2452,2460 ----
tree bitpos;
/* The alignment of the record so far, in bits. */
unsigned int record_align;
! /* The alignment of the record so far, ignoring #pragma pack and
! __attribute__ ((packed)), in bits. */
unsigned int unpacked_align;
/* The previous field layed out. */
tree prev_field;
/* The static variables (i.e., class variables, as opposed to
*************** typedef struct record_layout_info_s
*** 2464,2469 ****
--- 2462,2469 ----
tree pending_statics;
/* Bits remaining in the current alignment group */
int remaining_in_alignment;
+ /* True if we've seen a packed field that didn't have normal
+ alignment anyway. */
int packed_maybe_necessary;
} *record_layout_info;
*** ./gcc/doc/tm.texi.~1~ 2003-03-31 15:26:29.000000000 -0500
--- ./gcc/doc/tm.texi 2003-03-25 17:29:08.000000000 -0500
*************** make it all fit in fewer cache lines.
*** 1160,1167 ****
Alignment in bits to be given to a structure bit-field that follows an
empty field such as @code{int : 0;}.
! Note that @code{PCC_BITFIELD_TYPE_MATTERS} also affects the alignment
! that results from an empty field.
@findex STRUCTURE_SIZE_BOUNDARY
@item STRUCTURE_SIZE_BOUNDARY
--- 1160,1166 ----
Alignment in bits to be given to a structure bit-field that follows an
empty field such as @code{int : 0;}.
! If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
@findex STRUCTURE_SIZE_BOUNDARY
@item STRUCTURE_SIZE_BOUNDARY