Fix internal error on extension with interface at -O2
commit5d01fc7c11606fa0fa36210309df6b10b6e07775
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 25 Jan 2021 10:27:29 +0000 (25 11:27 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 25 Jan 2021 10:30:00 +0000 (25 11:30 +0100)
tree390e5b51d018b3a0f54487789c98ddc0ef682ef7
parentc6b0e33febbf73abfcc2bb0e28f0b62afe3b0f2a
Fix internal error on extension with interface at -O2

This is a regression present on the mainline, 10 and 9 branches, in the
form of an internal error with the Ada compiler when a covariant-only
thunk is inlined into its caller.

gcc/ada/
* gcc-interface/trans.c (make_covariant_thunk): Set the DECL_CONTEXT
of the parameters and do not set TREE_PUBLIC on the thunk.
(maybe_make_gnu_thunk): Pass the alias to the covariant thunk.
* gcc-interface/utils.c (finish_subprog_decl): Set the DECL_CONTEXT
of the parameters here...
(begin_subprog_body): ...instead of here.

gcc/testsuite/
* gnat.dg/thunk2.adb, gnat.dg/thunk2.ads: New test.
* gnat.dg/thunk2_pkg.ads: New helper.
gcc/ada/gcc-interface/trans.c
gcc/ada/gcc-interface/utils.c
gcc/testsuite/gnat.dg/thunk2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/thunk2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/thunk2_pkg.ads [new file with mode: 0644]