[Ada] Fix Max_Size_In_Storage_Elements for unconstrained array types

Eric Botcazou ebotcazou@adacore.com
Fri Dec 14 11:08:00 GMT 2018


It appears that GNAT was not fully compliant with the intent of the RM here 
because it wouldn't include the size of the bounds added in front of the data 
in an allocation in the value of Max_Size_In_Storage_Elements.

Tested on x86_64-suse-linux, applied on the mainline.


2018-12-14  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (rm_size): Take into account the padding in
	the case of a record type containing a template.
	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Likewise.
	Do not subtract the padded size for Max_Size_In_Storage_Elements.
	<Attr_Descriptor_Size>: Tweak comment.


2018-12-14  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/max_size.adb: New test.
	* gnat.dg/max_size_pkg.ads: Likewise.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 3347 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181214/3ee5d5b6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: max_size.adb
Type: text/x-adasrc
Size: 258 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181214/3ee5d5b6/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: max_size_pkg.ads
Type: text/x-adasrc
Size: 188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181214/3ee5d5b6/attachment-0002.bin>


More information about the Gcc-patches mailing list