[Ada] Fix inconsistent Value_Size for Strict_Alignment types

Eric Botcazou ebotcazou@adacore.com
Sat Jun 29 08:10:00 GMT 2019

In Ada we have what we call strict-alignment types, i.e. types that can never 
be misaligned in record types.  They are exactly the types which contain an 
aliased field, either explicitly or implicitly (i.e. tagged types).

For them, by definition of 'Size in the Ada RM, this 'Size must be equal to 
the natural size, which means that 'Value_Size = 'Object_Size for GNAT.

Tested on x86-64/Linux, applied on mainline.

2019-06-29  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: If the
	type requires strict alignment, then set the RM size to the type size.
	Rework handling of alignment and sizes of tagged types in ASIS mode.
	(validate_size): Rename local variable and remove special handling for
	strict-alignment types.
	* gcc-interface/utils.c (finish_record_type): Constify local variables
	and use properly typed constants.

2019-06-29  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/size_clause3.ads: Adjust error message.

Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 11143 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190629/9e1eb0c2/attachment.bin>

More information about the Gcc-patches mailing list