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
This commit is contained in:
Eric Botcazou 2012-11-30 22:36:07 +00:00 committed by Eric Botcazou
parent d5651dcfe8
commit a37d67b621
4 changed files with 32 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2012-11-30 Eric Botcazou <ebotcazou@adacore.com>
* stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Deal
with degenerate cases where the bitsize isn't positive. Rework comment.
2012-11-30 David Edelsohn <dje.gcc@gmail.com>
* xcoffout.c (xcoff_tls_data_section_name): Define.

View File

@ -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;
}

View File

@ -1,3 +1,7 @@
2012-11-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/pack9.ads: New test.
2012-11-30 Martin Jambor <mjambor@suse.cz>
PR middle-end/52890

View File

@ -0,0 +1,15 @@
-- { dg-do compile }
package Pack9 is
subtype Zero is Natural range 0 .. 0;
type Rec (D : Boolean) is record
case D is
when True => Z : Zero;
when False => null;
end case;
end record;
pragma Pack (Rec);
end Pack9;