[Ada] Crash on exported build-in-place function
authorBob Duff <duff@adacore.com>
Fri, 5 Jul 2019 07:02:37 +0000 (07:02 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Fri, 5 Jul 2019 07:02:37 +0000 (07:02 +0000)
commitadc81ec81db382128869cd62ca4e48bd87d1d880
tree5c8f54e936d85b4dc0ac2d46852173e695fa850b
parent7145d799a347800ea6ef5c5e3114db11469137a8
[Ada] Crash on exported build-in-place function

This patch fixes a bug where if a function is build-in-place, and is
exported, and contains an extended_return_statement whose object is
initialized with another build-in-place function call, then the compiler
will crash.

2019-07-05  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_ch6.adb (Is_Build_In_Place_Function): Narrow the check for
Has_Foreign_Convention to the imported case only.  If a
build-in-place function is exported, and called from Ada code,
build-in-place protocols should be used.

gcc/testsuite/

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

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