diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-30 22:36:07 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-30 22:36:07 +0000 |
commit | 392630d478ae0ec3abac3e50336ac02a2e2084ef (patch) | |
tree | 8742e0d457e3f981f7a1906fe1a27dfb6a4e6600 /gcc/stor-layout.c | |
parent | 3f854611d7a3da530be391541ed4e6c7ffef60f2 (diff) | |
download | gcc-392630d478ae0ec3abac3e50336ac02a2e2084ef.tar.gz |
* stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Deal
with degenerate cases where the bitsize isn't positive. Rework comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 3d97796da5c..4227694a4be 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; } |