https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42413
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marc Poulhies <[email protected]>: https://gcc.gnu.org/g:54916fe29160db42c3c4e3592bac2d5400892f17 commit r17-1194-g54916fe29160db42c3c4e3592bac2d5400892f17 Author: Eric Botcazou <[email protected]> Date: Fri Apr 10 12:44:47 2026 +0200 ada: Fix problematic call to function returning task in anonymous context The problem is that the task returned by the call to the function is never activated. This is fixed by creating a transient scope around the call, as is done for controlled types, after making transient scopes compatible with task types. gcc/ada/ChangeLog: PR ada/42413 * exp_ch4.adb (Process_Transients_In_Expression): Deal with a task activation chain present in the statement list. * exp_ch6.adb (Make_Build_In_Place_Call_In_Anonymous_Context): Also establish a transient scope if the result type has tasks. * exp_ch7.adb (Make_Transient_Block): Deal with Has_Master_Entity and Has_Activation_Chain_Entity set on the transient scope. * exp_ch9.ads (Make_Task_Activation_Call): New declaration from... * exp_ch9.adb (Make_Task_Activation_Call): ...here. (Build_Activation_Chain_Entity): Deal with transient scopes. (Build_Master_Entity): Likewise. (Find_Enclosing_Context): Likewise. * sem_elab.adb (Activation_Processor.Process_Activation): Deal with N_Expression_With_Actions nodes. * sem_util.adb (Current_Entity_In_Scope): Prevent transient scopes from being transparent for _Chain and _Master entities.
