[Ada] Wrong dispatching call in type with aspect Implicit_Dereference

Pierre-Marie de Rodat derodat@adacore.com
Tue Aug 13 09:09:00 GMT 2019


When a record type with an an access to class-wide type discriminant
has aspect Implicit_Dereference, and the discriminant is used as the
controlling argument of a dispatching call, the compiler may generate
wrong code to dispatch the call.

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

2019-08-13  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Selected_Component): When the type of the
	component is an access to a class-wide type and the type of the
	context is an access to a tagged type the relevant type is that
	of the component (since in such case we may need to generate
	implicit type conversions or dispatching calls).

gcc/testsuite/

	* gnat.dg/tagged3.adb, gnat.dg/tagged3_pkg.adb,
	gnat.dg/tagged3_pkg.ads: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 2940 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190813/60a085f0/attachment.bin>


More information about the Gcc-patches mailing list