[Ada] Wrong interface dynamic dispatch via access parameter
authorJavier Miranda <miranda@adacore.com>
Wed, 13 Apr 2022 16:27:59 +0000 (16:27 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 19 May 2022 14:05:31 +0000 (14:05 +0000)
commit8a03acaace9544249583e630153e73d53ccfaec7
treef7895b37741485d2512a7eaafc7f919a3e40b203
parenteff70bcc1f1e808e3cc253a8452b7849329d549a
[Ada] Wrong interface dynamic dispatch via access parameter

When the prefix of an Access attribute is an explicit dereference of an
access parameter (or a renaming of such a dereference, or a subcomponent
of such a dereference), the context is a general access type to a
class-wide interface type, and an accessibility check must be generated,
the frontend silently skips generating an implicit type conversion to
force the displacement of the pointer to reference the secondary
dispatch table.

gcc/ada/

* exp_attr.adb (Add_Implicit_Interface_Type_Conversion): New
subprogram which factorizes code.
(Expand_N_Attribute_Reference): Call the new subprogram to add
the missing implicit interface type conversion.
gcc/ada/exp_attr.adb