r260886 - in /trunk/gcc: ada/ChangeLog ada/exp_...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Tue May 29 09:42:00 GMT 2018


Author: pmderodat
Date: Tue May 29 09:42:34 2018
New Revision: 260886

URL: https://gcc.gnu.org/viewcvs?rev=260886&root=gcc&view=rev
Log:
[Ada] Wrong equality on untagged private type

When a private type declaration T1 is completed with a derivation of an
untagged private type that overrides the predefined equality primitive, and the
full view of T2 is a derivation of another private type T2 whose full view is a
tagged type, the compiler may generate code that references the wrong equality
primitive when processing comparisons of objects of type T1.

2018-05-29  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_ch4.adb (Expand_N_Op_Eq, Expand_Composite_Equality): Use the new
	subprogram Inherits_From_Tagged_Full_View to identify more reliably
	untagged private types completed with a derivation of an untagged
	private whose full view is a tagged type.
	* sem_util.ads, sem_util.adb (Inherits_From_Tagged_Full_View): New
	subprogram.
	(Collect_Primitive_Operations): Handle untagged private types completed
	with a derivation of an untagged private type whose full view is a
	tagged type. In such case, collecting the list of primitives we may
	find two equality primitives: one associated with the untagged private
	and another associated with the ultimate tagged type (and we must
	remove from the returned list this latter one).

gcc/testsuite/

	* gnat.dg/equal2.adb: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/equal2.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/exp_ch4.adb
    trunk/gcc/ada/sem_util.adb
    trunk/gcc/ada/sem_util.ads
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list