Commit 75a582cd by Eric Botcazou Committed by Eric Botcazou

decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict…

decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an...

	* gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing
	for a field without strict alignment and with an oversized clause.

From-SVN: r276873
parent 76dcb70d
2019-10-11 Eric Botcazou <ebotcazou@adacore.com> 2019-10-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing
for a field without strict alignment and with an oversized clause.
2019-10-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the
sign of the value when deciding to build a NEGATE_EXPR. sign of the value when deciding to build a NEGATE_EXPR.
<PLUS_EXPR>: Remove redundant line. <PLUS_EXPR>: Remove redundant line.
......
...@@ -7229,10 +7229,17 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, ...@@ -7229,10 +7229,17 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
&& INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type)))) && INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type))))
gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type));
orig_field_type = gnu_field_type;
gnu_field_type gnu_field_type
= make_type_from_size (gnu_field_type, gnu_size, = make_type_from_size (gnu_field_type, gnu_size,
Has_Biased_Representation (gnat_field)); Has_Biased_Representation (gnat_field));
/* If the type has been extended, we may need to cap the alignment. */
if (!needs_strict_alignment
&& gnu_field_type != orig_field_type
&& tree_int_cst_lt (TYPE_SIZE (orig_field_type), gnu_size))
packed = adjust_packed (gnu_field_type, gnu_record_type, packed);
orig_field_type = gnu_field_type; orig_field_type = gnu_field_type;
gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, gnat_field, gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, gnat_field,
false, false, definition, true); false, false, definition, true);
......
2019-10-11 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/size_clause4.ads: New test.
2019-10-11 Ilya Leoshkevich <iii@linux.ibm.com> 2019-10-11 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/77918 PR target/77918
......
-- { dg-do compile }
with System;
package Size_Clause4 is
type Rec is record
A1 : System.Address;
A2 : System.Address;
I : aliased Integer;
end record;
for Rec use record
A1 at 0 range 0 .. 63;
A2 at 8 range 0 .. 63;
I at 16 range 0 .. 31;
end record;
for Rec'Size use 160;
end Size_Clause4;
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