[Ada] Spurious visibility error in inlined function
authorHristian Kirtchev <kirtchev@adacore.com>
Wed, 3 Jul 2019 08:15:54 +0000 (08:15 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 3 Jul 2019 08:15:54 +0000 (08:15 +0000)
commitabc856cf227c4a97ddb4697bb51ab0da8dba4d94
tree6e6c2f1efc4a5602bf9a67beab58af8616112ac2
parent866000e7fb53a137db4e876dcd3f6b46195a6683
[Ada] Spurious visibility error in inlined function

This patch corrects the use of tree replication when inlining a function
that returns an unconstrained result, and its sole statement is an
extended return statement. The use of New_Copy_Tree ensires that global
references saved in a generic template are properly carried over when
the function is instantiated and inlined.

2019-07-03  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* inline.adb (Build_Return_Object_Formal): New routine.
(Can_Split_Unconstrained_Function): Code clean up.
(Copy_Formals,Copy_Return_Object): New routines.
(Split_Unconstrained_Function): Code clean up and refactoring.

gcc/testsuite/

* gnat.dg/inline15.adb, gnat.dg/inline15_gen.adb,
gnat.dg/inline15_gen.ads, gnat.dg/inline15_types.ads: New
testcase.

From-SVN: r272980
gcc/ada/ChangeLog
gcc/ada/inline.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/inline15.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline15_gen.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline15_gen.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline15_types.ads [new file with mode: 0644]