ada: Fix internal error on imported function with post-condition
commit54dd56f5c82ff26e46e8b24214d0988da8e3ad8a
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 24 Apr 2023 15:11:01 +0000 (24 17:11 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 13 Jun 2023 07:31:44 +0000 (13 09:31 +0200)
tree9cf1b52a7b3a4d2cc2f1684119cb286e87233182
parentc0ceba6c86ae4fcefa720b0976c58481c903eb63
ada: Fix internal error on imported function with post-condition

The problem, which is also present for an expression function, is that the
function is invoked in the initializing expression of a variable declared
in the same declarative part as the function, which causes the freezing of
its artificial body before the post-condition is analyzed on its spec.

gcc/ada/

* contracts.adb (Analyze_Entry_Or_Subprogram_Body_Contract): For a
subprogram body that has no contracts and does not come from source,
make sure that contracts on its corresponding spec are analyzed, if
any, before expanding them.
gcc/ada/contracts.adb