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]

[Ada] Allow Object_Size that is a multiple of the alignment


For composite types, any object size should be allowed that is a multiple
of the alignment, but the front end was rejecting some cases. The following
should compile clean, giving the output shown for -gnatR2:

     1. package ObjSizeTest is
     2.    type R is record
     3.       A : Integer;
     4.       B : Character;
     5.    end record;
     6.    for R'Object_Size use 40;
     7.    for R'Size use 40;
     8.    for R'Alignment use 1;
     9. end ObjSizeTest;

Representation information for unit Objsizetest (spec)

for R'Size use 40;
for R'Alignment use 1;
for R use record
   A at 0 range  0 .. 31;
   B at 4 range  0 ..  7;
end record;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-02-20  Robert Dewar  <dewar@adacore.com>

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause, case
	Object_Size): For non-scalar types allow any value that is a
	multiple of 8.
	* gnat_rm.texi: Document Object_Size for composites more clearly.

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]