[Ada] Crash due to missing freeze nodes in transient scope
authorHristian Kirtchev <kirtchev@adacore.com>
Mon, 1 Jul 2019 13:34:25 +0000 (13:34 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 1 Jul 2019 13:34:25 +0000 (13:34 +0000)
commit867edb0b613898bec9128e1ecb055c3277e34dbc
tree82da28faf0e0f626407d351e1a5922e445560637
parent7b3a8d3440a387d326c7b659617fd126ff5371a6
[Ada] Crash due to missing freeze nodes in transient scope

The following patch updates the freezing of expressions to insert the
generated freeze nodes prior to the expression that produced them when
the context is a transient scope within a type initialization procedure.
This ensures that the nodes are properly interleaved with respect to the
constructs that generated them.

2019-07-01  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* freeze.adb (Freeze_Expression): Remove the horrible useless
name hiding of N. Insert the freeze nodes generated by the
expression prior to the expression when the nearest enclosing
scope is transient.

gcc/testsuite/

* gnat.dg/freezing1.adb, gnat.dg/freezing1.ads,
gnat.dg/freezing1_pack.adb, gnat.dg/freezing1_pack.ads: New
testcase.

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