[Ada] Incorrect expansion on renamings of formal parameters
authorJustin Squirek <squirek@adacore.com>
Wed, 3 Jul 2019 08:16:06 +0000 (08:16 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 3 Jul 2019 08:16:06 +0000 (08:16 +0000)
commiteee51f3dd6d8e444270efb6fe191524b79a01445
treed5f2bf106c172d9babbac0a02a9f9065c963f7a6
parentf4c16c58e1a91f412eae9dd6645c165a709246cb
[Ada] Incorrect expansion on renamings of formal parameters

This patch fixes an issue whereby a renaming of an unconstrained formal
parameter leads to spurious runtime errors; manifesting either as a
storage or constraint error due to incorrect bounds being assumed.

This issue also occurs when the renamings are implicit such as through
generic instantiations.

2019-07-03  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_ch8.adb (Analyze_Object_Renaming): Add call to search for
the appropriate actual subtype of the object renaming being
analyzed.
(Check_Constrained_Object): Minor cleanup.

gcc/testsuite/

* gnat.dg/renaming13.adb, gnat.dg/renaming14.adb: New testcases.

From-SVN: r272982
gcc/ada/ChangeLog
gcc/ada/sem_ch8.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/renaming13.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/renaming14.adb [new file with mode: 0644]