[Ada] Crash on build-in-place call with address specification for target
authorEd Schonberg <schonberg@adacore.com>
Thu, 11 Jan 2018 08:56:12 +0000 (08:56 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 11 Jan 2018 08:56:12 +0000 (08:56 +0000)
commita2dbe7d5ae0627efc7079ff59f39487b78a2423d
tree96944ace87d69544773593487f19776928d46ea9
parent791f2d03b4c611040b0d20b61441b438eecef8b8
[Ada] Crash on build-in-place call with address specification for target

The presence of an address clause complicates the build-in-place expansion
because the indicated address must be processed before the indirect call is
generated, including the definition of a local pointer to the object.

The address clause may come from an aspect specification or from an explicit
attribute specification appearing after the object declaration. These two
cases require different processing.

2018-01-11  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Handle
properly object declarations with initializations that are
build-in-place function calls, when there is an address specification,
either as an aspect specification or an explicit attribute
specification clause, for the initialized object.
* freeze.adb (Check_Address_Clause): Do not remove side-effects from
initial expressions in the case of a build-in-place call.

gcc/testsuite/

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

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