[Ada] Crash on front-end inlining of subp. with aspect specifications
authorEd Schonberg <schonberg@adacore.com>
Wed, 3 Jul 2019 08:16:11 +0000 (08:16 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 3 Jul 2019 08:16:11 +0000 (08:16 +0000)
commit5460389b1fde0393afeaab5ce338ebe72a517cae
tree8ede8d2ef640803b5dc6e2a8358d56ff9cc36a3f
parenteee51f3dd6d8e444270efb6fe191524b79a01445
[Ada] Crash on front-end inlining of subp. with aspect specifications

This patch fixes a gap in the handling of formals when inlining a call
to a subprogram marked Inline_Always. For the inlining, the formals are
replaced by the actuals in the block constructed for inlining, The
traversal that performs this replacement does not apply to aspect
specifications that may appear in the original body, because these
aspects are only indirectly reachable from the nodes to which they
apply: a separate traversal is required to perform the replacement in
the expressions for any aspect specification present in the source.

2019-07-03  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* inline.adb (Process_Formals_In_Aspects): New procedure within
Expand_Inlined_Call, to perform a replacement of references to
formals that appear in aspect specifications within the body
being inlined.

gcc/testsuite/

* gnat.dg/inline16.adb, gnat.dg/inline16_gen.adb,
gnat.dg/inline16_gen.ads, gnat.dg/inline16_types.ads: New
testcase.

From-SVN: r272983
gcc/ada/ChangeLog
gcc/ada/inline.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/inline16.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline16_gen.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline16_gen.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline16_types.ads [new file with mode: 0644]