[Ada] Enumeration types with non-standard representation

Pierre-Marie de Rodat derodat@adacore.com
Tue Aug 21 15:02:00 GMT 2018


The compiler may report errors on enumeration types with non-standard
representation (i.e. at least one literal has a representation value
different from its 'Pos value) processing attribute 'Enum_Rep.

It may also generate wrong code for the evaluation of 'Enum_Rep raising
Constraint_Error at runtime.

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

2018-08-21  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* checks.ads (Determine_Range): Adding documentation.
	* checks.adb (Determine_Range): Don't deal with enumerated types
	with non-standard representation.
	(Convert_And_Check_Range): For conversion of enumeration types
	with non standard representation to an integer type perform a
	direct conversion to the target integer type.

gcc/testsuite/

	* gnat.dg/enum4.adb: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 6296 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180821/d566c0b5/attachment.bin>


More information about the Gcc-patches mailing list