ada: Fix crash on semi-recursive call in access-to-subprogram contract
commit9f29fc75351870da24c1a94986be031989a88509
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 7 Apr 2023 11:55:09 +0000 (7 13:55 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:21 +0000 (29 10:23 +0200)
tree75ee1ec6b9d8f5dff57ab0f601621155675bbfb2
parent11f406ee4747e48a9b0e34aa6f6b3cdb38665a1b
ada: Fix crash on semi-recursive call in access-to-subprogram contract

Calls to access-to-subprogram from its own pre/post aspects are rejected
as illegal, e.g.:

   type F is access function (X : Natural) return Boolean with
     Pre => F.all (X);

but they caused an assertion failure in detection of recursive calls.

Now they are properly recognized as recursive, but the error is
suppressed, because it has been already posted at the call node.

gcc/ada/

* sem_res.adb (Invoked_With_Different_Arguments): Use Get_Called_Entity,
which properly deals with calls via an access-to-subprogram; fix
inconsistent use of a Call object declared in enclosing subprogram.
gcc/ada/sem_res.adb