[Ada] Spurious elaboration issue due to inlining
authorHristian Kirtchev <kirtchev@adacore.com>
Wed, 26 Sep 2018 09:19:28 +0000 (09:19 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 26 Sep 2018 09:19:28 +0000 (09:19 +0000)
commit1a409f80df7452dbcab228390a2de483bed5b875
tree0358e2c62d3402b7a22eb399e9c80779b756d4c1
parenta30a69c1229cbf5270d2048299da5b9ae171e226
[Ada] Spurious elaboration issue due to inlining

This patch ensures that the full compilation context is captured prior
to package or subprogram instantiation/inlining and restored after the
action takes place.

2018-09-26  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_ch12.adb (Instantiate_Package_Body): Capture and restore
the full compilation context.
(Instantiate_Subprogram_Body): Capture and restore the full
compilation context.

gcc/testsuite/

* gnat.dg/elab7.adb, gnat.dg/elab7_pkg1.adb,
gnat.dg/elab7_pkg1.ads, gnat.dg/elab7_pkg2.adb,
gnat.dg/elab7_pkg2.ads: New testcase.

From-SVN: r264630
gcc/ada/ChangeLog
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/elab7.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/elab7_pkg1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/elab7_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/elab7_pkg2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/elab7_pkg2.ads [new file with mode: 0644]