diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 09:09:53 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 09:09:53 +0000 |
commit | ada34defa75a6170e63bbe2f141a285383f8d25e (patch) | |
tree | 2828113a0adb99fba99fd5be023a012fe6df3036 /gcc/ada/freeze.adb | |
parent | 423f3858dcd90e10987db190630fca9840b3fe77 (diff) | |
download | gcc-ada34defa75a6170e63bbe2f141a285383f8d25e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177339 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index c6da2c9041c..a31e6476434 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -623,13 +623,6 @@ package body Freeze is if S > 32 then return; - -- Don't bother if alignment clause with a value other than 1 is - -- present, because size may be padded up to meet back end alignment - -- requirements, and only the back end knows the rules! - - elsif Known_Alignment (T) and then Alignment (T) /= 1 then - return; - -- Check for bad size clause given elsif Has_Size_Clause (T) then @@ -638,21 +631,12 @@ package body Freeze is Error_Msg_NE ("size for& too small, minimum allowed is ^", Size_Clause (T), T); - - elsif Unknown_Esize (T) then - Set_Esize (T, S); end if; - -- Set sizes if not set already - - else - if Unknown_Esize (T) then - Set_Esize (T, S); - end if; + -- Set size if not set already - if Unknown_RM_Size (T) then - Set_RM_Size (T, S); - end if; + elsif Unknown_RM_Size (T) then + Set_RM_Size (T, S); end if; end Set_Small_Size; @@ -836,7 +820,7 @@ package body Freeze is if not Is_Constrained (T) and then No (Discriminant_Default_Value (First_Discriminant (T))) - and then Unknown_Esize (T) + and then Unknown_RM_Size (T) then return False; end if; @@ -2251,12 +2235,12 @@ package body Freeze is -- less than the sum of the object sizes (no point in packing if -- this is not the case). - and then Esize (Rec) < Scalar_Component_Total_Esize + and then RM_Size (Rec) < Scalar_Component_Total_Esize -- And the total RM size cannot be greater than the specified size -- since otherwise packing will not get us where we have to be! - and then Esize (Rec) >= Scalar_Component_Total_RM_Size + and then RM_Size (Rec) >= Scalar_Component_Total_RM_Size -- Never do implicit packing in CodePeer mode since we don't do -- any packing in this mode, since this generates over-complex @@ -3034,12 +3018,12 @@ package body Freeze is -- action that causes stuff to be inherited). if Present (Size_Clause (E)) - and then Known_Static_Esize (E) + and then Known_Static_RM_Size (E) and then not Is_Packed (E) and then not Has_Pragma_Pack (E) and then Number_Dimensions (E) = 1 and then not Has_Component_Size_Clause (E) - and then Known_Static_Esize (Ctyp) + and then Known_Static_RM_Size (Ctyp) and then not Is_Limited_Composite (E) and then not Is_Packed (Root_Type (E)) and then not Has_Component_Size_Clause (Root_Type (E)) @@ -3412,12 +3396,18 @@ package body Freeze is -- Start of processing for Alias_Atomic_Check begin + + -- If object size of component type isn't known, we + -- cannot be sure so we defer to the back end. + + if not Known_Static_Esize (Ctyp) then + null; + -- Case where component size has no effect. First - -- check for object size of component type known - -- and a multiple of the storage unit size. + -- check for object size of component type multiple + -- of the storage unit size. - if Known_Static_Esize (Ctyp) - and then Esize (Ctyp) mod System_Storage_Unit = 0 + elsif Esize (Ctyp) mod System_Storage_Unit = 0 -- OK in both packing case and component size case -- if RM size is known and static and the same as |