[Ada] Spurious constraint error on array of null-excluding components
authorJustin Squirek <squirek@adacore.com>
Mon, 28 May 2018 08:53:36 +0000 (08:53 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 28 May 2018 08:53:36 +0000 (08:53 +0000)
commit341e0bb6c54e541637031f30492d584a8e5e98f5
treeec2d3805900f0491479ada4b18d10c221045936b
parent9b19c244561c5d8c312af9e44eb62e77d42e1e65
[Ada] Spurious constraint error on array of null-excluding components

This patch fixes an issue whereby the compiler would raise spurious runtime
errors when an array of null-excluding components was initialized with an
expression which required the secondary stack (such as with an concatination
operation) due to certain generated checks which were incorrected performed
on internal object declarations.

2018-05-28  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_ch3.adb
(Build_Initialization_Call): Add logic to pass the appropriate actual to match
 new formal.
(Init_Formals): Add new formal *_skip_null_excluding_check
* exp_util.adb, exp_util.ads
(Enclosing_Init_Proc): Added to fetch the enclosing Init_Proc from the current
 scope.
(Inside_Init_Proc): Refactored to use Enclosing_Init_Proc
(Needs_Conditional_Null_Excluding_Check): Added to factorize the predicate
 used to determine how to generate an Init_Proc for a given type.
(Needs_Constant_Address): Minor reformatting
* sem_res.adb
(Resolve_Null): Add logic to generate a conditional check in certain cases

gcc/testsuite/

* gnat.dg/array31.adb: New testcase.

From-SVN: r260822
gcc/ada/ChangeLog
gcc/ada/exp_ch3.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads
gcc/ada/sem_res.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/array31.adb [new file with mode: 0644]