This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This changes the way size and alignment clauses interact with each other. Size clauses used to set the 'Size of a type in stone, although an alignment clause could force the back-end to set different values for 'Object_Size and 'Value_Size of the type, leading to an inconsistency when an object of this type is declared with this same size clause and rejected. 'Object_Size and 'Value_Size are now decoupled and a size clause on a type will only set the latter in stone; the former can now be increased by the back-end to support a given alignment. The following package must be rejected with the error: badsize.ads:10:21: size for "RR1" too small, minimum allowed is 64 and the layout given by -gnatR1: for r1'Object_Size use 64; for r1'Value_Size use 40; for r1'Alignment use 4; for r1 use record i at 0 range 0 .. 31; b at 4 range 0 .. 7; end record; ---- package badsize is type R1 is record I : Integer; B : Boolean; end record; for R1'Alignment use 4; for R1'Size use 40; RR1 : R1; for RR1'Size use 40; end; ---- Tested on x86_64-pc-linux-gnu, committed on trunk 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.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |