[Ada] Crash on generic instantiation in ignored Ghost context
authorHristian Kirtchev <kirtchev@adacore.com>
Tue, 11 Dec 2018 11:11:11 +0000 (11:11 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 11 Dec 2018 11:11:11 +0000 (11:11 +0000)
commit0617753f4a5bda865efe66192841c40abdab8c2e
treea849beae01291bb03fd29af6c8adc8103ffad47e
parent62ebfa527237ba42c9d93032dc008e82d482d271
[Ada] Crash on generic instantiation in ignored Ghost context

The following patch corrects the freezing of entities to properly
preserve all freeze nodes in case of recursive freezing when the context
is ignored Ghost, and the construct frozen is non-Ghost.

2018-12-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* freeze.adb (Add_To_Result): Move the ignored Ghost-specific
handling of freeze nodes to...
(Freeze_Entity): ...here. This ensures that the freeze nodes of
constructs that have recursive freezing are preserved when the
context is ignored Ghost, and the top level construct being
frozen is non-Ghost.

gcc/testsuite/

* gnat.dg/ghost3.adb, gnat.dg/ghost3.ads: New testcase.

From-SVN: r267001
gcc/ada/ChangeLog
gcc/ada/freeze.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/ghost3.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/ghost3.ads [new file with mode: 0644]