[Ada] Wrong initialization of Offset_To_Top in secondary DT
authorJavier Miranda <miranda@adacore.com>
Tue, 13 Aug 2019 08:06:34 +0000 (08:06 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 13 Aug 2019 08:06:34 +0000 (08:06 +0000)
commit7225a4797180b6dc515760b0c123001cda2b66a2
treec424bf1218d198f8bb88e58717a84c045bb839dc
parent4c19aa690451fbd5d84ce1534a903163e67182e3
[Ada] Wrong initialization of Offset_To_Top in secondary DT

The compiler does not initialize well the runtime information required
to perform at runtime interface conversions on derivations of tagged
types that implement interfaces and have variable size components.

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

gcc/ada/

* exp_disp.adb (Make_Secondary_DT): Handle record type
derivations that have interface components located at fixed
positions and interface components located at variable offset.
The offset of components located at fixed positions is computed
using the dummy object (similar to the case where all the
interface components are located at fixed positions).
(Make_DT): Build the dummy object for all tagged types that
implement interface types (that is, build it also for types with
variable size components), and use the dummy object to compute
the offset of all tag components located at fixed positions when
initializing the Interface_Table object.

gcc/testsuite/

* gnat.dg/tag2.adb, gnat.dg/tag2_pkg.ads: New testcase.

From-SVN: r274335
gcc/ada/ChangeLog
gcc/ada/exp_disp.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/tag2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/tag2_pkg.ads [new file with mode: 0644]