+2012-03-16 Richard Guenther <rguenther@suse.de>
+
+ * stor-layout.c (finish_bitfield_representative): Fall back
+ to the conservative maximum size if we cannot compute the
+ size of the tail padding.
+
2012-03-16 Tristan Gingold <gingold@adacore.com>
* config/vms/vms.h (TARGET_OS_CPP_BUILTINS): Define
- tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1)
+ tree_low_cst (DECL_SIZE (field), 1));
+ /* Round up bitsize to multiples of BITS_PER_UNIT. */
+ bitsize = (bitsize + BITS_PER_UNIT - 1) & ~(BITS_PER_UNIT - 1);
+
/* Now nothing tells us how to pad out bitsize ... */
nextf = DECL_CHAIN (field);
while (nextf && TREE_CODE (nextf) != FIELD_DECL)
{
/* ??? If you consider that tail-padding of this struct might be
re-used when deriving from it we cannot really do the following
- and thus need to set maxsize to bitsize? */
+ and thus need to set maxsize to bitsize? Also we cannot
+ generally rely on maxsize to fold to an integer constant, so
+ use bitsize as fallback for this case. */
tree maxsize = size_diffop (TYPE_SIZE_UNIT (DECL_CONTEXT (field)),
DECL_FIELD_OFFSET (repr));
- gcc_assert (host_integerp (maxsize, 1));
- maxbitsize = (tree_low_cst (maxsize, 1) * BITS_PER_UNIT
- - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1));
+ if (host_integerp (maxsize, 1))
+ maxbitsize = (tree_low_cst (maxsize, 1) * BITS_PER_UNIT
+ - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1));
+ else
+ maxbitsize = bitsize;
}
/* Only if we don't artificially break up the representative in
at byte offset. */
gcc_assert (maxbitsize % BITS_PER_UNIT == 0);
- /* Round up bitsize to multiples of BITS_PER_UNIT. */
- bitsize = (bitsize + BITS_PER_UNIT - 1) & ~(BITS_PER_UNIT - 1);
-
/* Find the smallest nice mode to use. */
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))