[Ada] Fix discrepancy in mechanism tracking private and full views
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 14 Aug 2019 09:51:12 +0000 (09:51 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 14 Aug 2019 09:51:12 +0000 (09:51 +0000)
commitebe1a04f30e07c84264da571ac4da003e8c4bc05
treedc41e7ed30ca612c7edcd965c84c748bdfda198d
parentd2d56bbae32be728ff82191b6d328e3a8d7c1530
[Ada] Fix discrepancy in mechanism tracking private and full views

This fixes a discrepancy in the mechanism tracking the private and full
views of entities when entering and leaving scopes.  This mechanism
records private entities that are dependent on other private entities,
so that the exchange done on entering and leaving scopes can be
propagated.

The propagation is done recursively on entering child units, but it was
not done recursively on leaving them, which would leave the dependency
chains in a uncertain state in this case.  That's mostly visible when
inlining across units is enabled for code involving a lot of generic
units.

2019-08-14  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_ch7.adb (Install_Private_Declarations)
<Swap_Private_Dependents>: Do not rely solely on the
Is_Child_Unit flag on the unit to recurse.
(Uninstall_Declarations) <Swap_Private_Dependents>: New
function.  Use it to recurse on the private dependent entities
for child units.

gcc/testsuite/

* gnat.dg/inline18.adb, gnat.dg/inline18.ads,
gnat.dg/inline18_gen1-inner_g.ads, gnat.dg/inline18_gen1.adb,
gnat.dg/inline18_gen1.ads, gnat.dg/inline18_gen2.adb,
gnat.dg/inline18_gen2.ads, gnat.dg/inline18_gen3.adb,
gnat.dg/inline18_gen3.ads, gnat.dg/inline18_pkg1.adb,
gnat.dg/inline18_pkg1.ads, gnat.dg/inline18_pkg2-child.ads,
gnat.dg/inline18_pkg2.ads: New testcase.

From-SVN: r274451
16 files changed:
gcc/ada/ChangeLog
gcc/ada/sem_ch7.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/inline18.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen1-inner_g.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen3.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_gen3.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_pkg1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_pkg2-child.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline18_pkg2.ads [new file with mode: 0644]