[Ada] Missing check on outbound parameter of a non-null access type
commit68e4cc9854044a2f66623c5d8dd36bc27bd948f2
authorEd Schonberg <schonberg@adacore.com>
Mon, 12 Aug 2019 09:01:48 +0000 (12 09:01 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 12 Aug 2019 09:01:48 +0000 (12 09:01 +0000)
tree64f745c46e52948df67f3708e126e95652f6684a
parent8e4ca4fcffbe6d3855f67cd02e0bb2a40d62fa10
[Ada] Missing check on outbound parameter of a non-null access type

This patch adds code to generate proper post-call checks when an actual
for an in-out or out parameter has a non-null access type. No
constraints are applied to an inbound access parameter, but on exit a
not-null check must be performed if the type of the actual requires it.

2019-08-12  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch6.adb (Expand_Actuals. Add_Call_By_Copy_Code): Add code
to generate proper checks when an actual for an in-out or out
parameter has a non-null access type.  No constraints are
applied to an inbound access parameter, but on exit a not-null
check must be performed if the type of the actual requires it.

gcc/testsuite/

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

From-SVN: r274306
gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/null_check.adb [new file with mode: 0644]