Commit a37d67b6 by Eric Botcazou Committed by Eric Botcazou

stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Deal with…

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
parent d5651dcf
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> 2012-11-30 David Edelsohn <dje.gcc@gmail.com>
* xcoffout.c (xcoff_tls_data_section_name): Define. * xcoffout.c (xcoff_tls_data_section_name): Define.
...@@ -2648,10 +2648,14 @@ bit_field_mode_iterator ...@@ -2648,10 +2648,14 @@ bit_field_mode_iterator
{ {
if (!bitregion_end_) if (!bitregion_end_)
{ {
/* We can assume that any aligned chunk of UNITS bits that overlaps /* We can assume that any aligned chunk of ALIGN bits that overlaps
the bitfield is mapped and won't trap. */ the bitfield is mapped and won't trap, provided that ALIGN isn't
unsigned HOST_WIDE_INT units = MIN (align, MAX (BIGGEST_ALIGNMENT, too large. The cap is the biggest required alignment for data,
BITS_PER_WORD)); 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_ = bitpos + bitsize + units - 1;
bitregion_end_ -= bitregion_end_ % units + 1; bitregion_end_ -= bitregion_end_ % units + 1;
} }
......
2012-11-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/pack9.ads: New test.
2012-11-30 Martin Jambor <mjambor@suse.cz> 2012-11-30 Martin Jambor <mjambor@suse.cz>
PR middle-end/52890 PR middle-end/52890
......
-- { 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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment