[Ada] Attribute Img on derived types

Pierre-Marie de Rodat derodat@adacore.com
Fri Oct 16 07:35:40 GMT 2020


This patch fixes the handling of the Ada_2020 attribute Img when applied
to derived types. If the type is private it is necessary to retrieve a
non-private description of the type structure, by using an underlying
view (which crosses the privacy boundary). The underlying view is that
of the base type of the object, but not its root type, which might
ignore components of a type extension and produce spurious type errors.

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

gcc/ada/

	*  exp_imgv.adb (Expand_Image_Attribute): Use the base type
	instead of the root type when type of object is private. Remove
	Ada_2020 guard, because it has been checked during prior
	analysis. Use Underlying_Type in all cases, as it is a no-op on
	types that are not private.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1803 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201016/b7c5471a/attachment-0001.bin>


More information about the Gcc-patches mailing list