[Ada] Fix spurious violations of No_Secondary_Stack restriction
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 14 Apr 2022 15:31:44 +0000 (17:31 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 19 May 2022 14:05:31 +0000 (14:05 +0000)
commitbf0b180b42babb61b4e16388b88350d75aad3c27
treece885fdfa478182d1bf1512e675abc1d29bc0264
parente478e16e8a8a256c8c117f0bbe54a3078c086bc2
[Ada] Fix spurious violations of No_Secondary_Stack restriction

Now that finalization and return on the secondary stack are decoupled, the
transient scopes created because of the former need not necessarily manage
the secondary stack and trigger a violation of the associated restriction.

gcc/ada/

* exp_ch7.adb (Wrap_Transient_Declaration): Propagate Uses_Sec_Stack
to enclosing function if it does not return on the secondary stack.
* exp_ch6.adb (Expand_Call_Helper): Call Establish_Transient_Scope
with Manage_Sec_Stack set to True only when necessary.
* sem_res.adb (Resolve_Call): Likewise.
(Resolve_Entry_Call): Likewise.
gcc/ada/exp_ch6.adb
gcc/ada/exp_ch7.adb
gcc/ada/sem_res.adb