Commit 03049a4e by Eric Botcazou Committed by Eric Botcazou

decl.c (set_rm_size): Bypass the check for packed array types.

	* gcc-interface/decl.c (set_rm_size): Bypass the check for packed array
	types.

From-SVN: r147819
parent aae8570a
2009-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (set_rm_size): Bypass the check for packed array
types.
2009-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Do not modify the
original type because of the alignment when there is an address clause.
......
......@@ -7391,11 +7391,18 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity)
if (CONTAINS_PLACEHOLDER_P (old_size))
old_size = max_size (old_size, true);
/* If the size of the object is a constant, the new size must not be
smaller (the front-end checks this for scalar types). */
/* If the size of the object is a constant, the new size must not be smaller
(the front-end has verified this for scalar and packed array types). */
if (TREE_CODE (old_size) != INTEGER_CST
|| TREE_OVERFLOW (old_size)
|| (AGGREGATE_TYPE_P (gnu_type) && tree_int_cst_lt (size, old_size)))
|| (AGGREGATE_TYPE_P (gnu_type)
&& !(TREE_CODE (gnu_type) == ARRAY_TYPE
&& TYPE_PACKED_ARRAY_TYPE_P (gnu_type))
&& !(TREE_CODE (gnu_type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (gnu_type)
&& TREE_CODE (TREE_TYPE (TYPE_FIELDS (gnu_type))) == ARRAY_TYPE
&& TYPE_PACKED_ARRAY_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_type))))
&& tree_int_cst_lt (size, old_size)))
{
if (Present (gnat_attr_node))
post_error_ne_tree
......
2009-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/rep_clause3.ads: New test.
2009-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/addr6.adb: New test.
2009-05-22 Mark Mitchell <mark@codesourcery.com>
......
package Rep_Clause3 is
type Record1 is
record
Page_Handle : Integer range 0 .. 255;
Page_Owner : Integer range 0 .. 15;
end record;
for Record1 use
record
Page_Handle at 0 range 0 .. 15;
Page_Owner at 0 range 16 .. 19;
end record;
for Record1'Size use 20;
type Range_A is range 1 .. 7;
for Range_A'Size use 16;
type Array_Type is array (Range_A) of Record1;
pragma Pack (Array_Type);
for Array_Type'Size use 7 * 20;
-- for array_Type'alignment use 1;
type Record2 is
record
Page_Tree_Index : Range_A;
Page_Tree : Array_Type;
end record;
for Record2 use
record
Page_Tree_Index at 0 range 0 .. 15;
Page_Tree at 0 range 16 .. 15 + (7 * 20);
end record;
for Record2'Size use 16 + (7 * 20);
end Rep_Clause3;
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