diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-04 11:09:53 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-04 11:09:53 +0200 |
commit | fc893455a5c2c9238f077412cf5a0bdc29abed34 (patch) | |
tree | 2828113a0adb99fba99fd5be023a012fe6df3036 /gcc/ada/gcc-interface/decl.c | |
parent | b37d5bc62b96ecbd96f409281f8741d40c4d3922 (diff) | |
download | gcc-fc893455a5c2c9238f077412cf5a0bdc29abed34.zip gcc-fc893455a5c2c9238f077412cf5a0bdc29abed34.tar.gz gcc-fc893455a5c2c9238f077412cf5a0bdc29abed34.tar.bz2 |
[multiple changes]
2011-08-04 Eric Botcazou <ebotcazou@adacore.com>
* layout.adb (Layout_Type): For composite types, do not set Esize.
* freeze.adb (Set_Small_Size): Remove test on alignment and do not
set Esize.
(Size_Known): Look at the RM size of components instead of the Esize.
(Freeze_Record_Type): Look at the RM size instead of the Esize to
issue warning and activate Implicit_Packing.
(Freeze_Entity): Likewise. Do not issue a warning for alias/atomic
if the Esize is not known.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Size>: Set Esize
for elementary types only.
(Analyze_Record_Representation_Clause): Look at the RM size instead
of the Esize to issue errors.
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set Esize if it
is not known.
<E_Record_Type>: Look at the RM size instead of the Esize. Remove
obsolete block.
Look at the RM size instead of the Esize for types if the latter is
not known.
(gnat_to_gnu_field): Use Known_Esize instead of Known_Static_Esize.
2011-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_type.adb: proper handling of equality not involving anonymous
access types.
From-SVN: r177339
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 99be625..512c05e 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -406,8 +406,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (esize > max_esize) esize = max_esize; } - else - esize = LONG_LONG_TYPE_SIZE; } switch (kind) @@ -2773,7 +2771,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ? -1 : (Known_Alignment (gnat_entity) || (Strict_Alignment (gnat_entity) - && Known_Static_Esize (gnat_entity))) + && Known_RM_Size (gnat_entity))) ? -2 : 0; bool has_discr = Has_Discriminants (gnat_entity); @@ -2824,8 +2822,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If both a size and rep clause was specified, put the size in the record type now so that it can get the proper mode. */ - if (has_rep && Known_Esize (gnat_entity)) - TYPE_SIZE (gnu_type) = UI_To_gnu (Esize (gnat_entity), sizetype); + if (has_rep && Known_RM_Size (gnat_entity)) + TYPE_SIZE (gnu_type) + = UI_To_gnu (RM_Size (gnat_entity), bitsizetype); /* Always set the alignment here so that it can be used to set the mode, if it is making the alignment stricter. If @@ -2842,9 +2841,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) type size instead of the RM size (see validate_size). Cap the alignment, lest it causes this type size to become too large. */ else if (Strict_Alignment (gnat_entity) - && Known_Static_Esize (gnat_entity)) + && Known_RM_Size (gnat_entity)) { - unsigned int raw_size = UI_To_Int (Esize (gnat_entity)); + unsigned int raw_size = UI_To_Int (RM_Size (gnat_entity)); unsigned int raw_align = raw_size & -raw_size; if (raw_align < BIGGEST_ALIGNMENT) TYPE_ALIGN (gnu_type) = raw_align; @@ -4583,9 +4582,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) confirming or we don't handle it properly (if the low bound is non-constant). */ if (!gnu_size && kind != E_String_Literal_Subtype) - gnu_size = validate_size (Esize (gnat_entity), gnu_type, gnat_entity, - TYPE_DECL, false, - Has_Size_Clause (gnat_entity)); + { + Uint gnat_size = Known_Esize (gnat_entity) + ? Esize (gnat_entity) : RM_Size (gnat_entity); + gnu_size + = validate_size (gnat_size, gnu_type, gnat_entity, TYPE_DECL, + false, Has_Size_Clause (gnat_entity)); + } /* If a size was specified, see if we can make a new type of that size by rearranging the type, for example from a fat to a thin pointer. */ @@ -6771,7 +6774,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, /* If a size is specified, use it. Otherwise, if the record type is packed, use the official RM size. See "Handling of Type'Size Values" in Einfo for further details. */ - if (Known_Static_Esize (gnat_field)) + if (Known_Esize (gnat_field)) gnu_size = validate_size (Esize (gnat_field), gnu_field_type, gnat_field, FIELD_DECL, false, true); else if (packed == 1) |