aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-11-30 22:36:07 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-11-30 22:36:07 +0000
commita37d67b62172f4835d32a83bf54c8c1b4d171271 (patch)
tree8742e0d457e3f981f7a1906fe1a27dfb6a4e6600 /gcc/stor-layout.c
parentd5651dcfe8b168b8e91a7fe1d32bc955187f9177 (diff)
downloadgcc-a37d67b62172f4835d32a83bf54c8c1b4d171271.zip
gcc-a37d67b62172f4835d32a83bf54c8c1b4d171271.tar.gz
gcc-a37d67b62172f4835d32a83bf54c8c1b4d171271.tar.bz2
stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Deal with degenerate cases where the bitsize isn't positive.
* stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Deal with degenerate cases where the bitsize isn't positive. Rework comment. From-SVN: r194009
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 3d97796..4227694 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2648,10 +2648,14 @@ bit_field_mode_iterator
{
if (!bitregion_end_)
{
- /* We can assume that any aligned chunk of UNITS bits that overlaps
- the bitfield is mapped and won't trap. */
- unsigned HOST_WIDE_INT units = MIN (align, MAX (BIGGEST_ALIGNMENT,
- BITS_PER_WORD));
+ /* We can assume that any aligned chunk of ALIGN bits that overlaps
+ the bitfield is mapped and won't trap, provided that ALIGN isn't
+ too large. The cap is the biggest required alignment for data,
+ or at least the word size. And force one such chunk at least. */
+ unsigned HOST_WIDE_INT units
+ = MIN (align, MAX (BIGGEST_ALIGNMENT, BITS_PER_WORD));
+ if (bitsize <= 0)
+ bitsize = 1;
bitregion_end_ = bitpos + bitsize + units - 1;
bitregion_end_ -= bitregion_end_ % units + 1;
}