[Ada] Get rid of more references to Universal_Integer in expanded code

Pierre-Marie de Rodat derodat@adacore.com
Wed Jun 3 10:03:04 GMT 2020


This further tweaks the expanded code generated by the front-end
for attributes returning Universal_Integer, in particular removes
hardcoded references to it and fixes a couple of type mismatches
in the process.

The only observable change is that 'Val is now expanded by the
front-end for integer types, for the sake of consistency with 'Pos.

No functional changes.

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

2020-06-03  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference) <Enum_Rep>:
	In the case of an enumeration type, do an intermediate
	conversion to a small integer type.  Remove useless stuff.
	<Finalization_Size>: Do not hardcode Universal_Integer and
	fix a type mismatch in the assignment to the variable.
	<Max_Size_In_Storage_Elements>: Likewise.
	<From_Any>: Do not redefine the Ptyp local variable.
	<To_Any>: Likewise.
	<TypeCode>: Likewise.
	<Pos>: Small tweaks.
	<Val>: For an enumeration type with standard representation,
	apply the range check to the expression of a convertion to
	Universal_Integer, if any.  For an integer type, expand to
	a mere conversion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 14535 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200603/dcb52f01/attachment-0001.bin>


More information about the Gcc-patches mailing list