From 8182602c5061ddc9c329ecef26a7fd77b9264ec0 Mon Sep 17 00:00:00 2001 From: Eric Botcazou <ebotcazou@adacore.com> Date: Fri, 6 May 2022 16:56:41 +0200 Subject: [PATCH] [Ada] Add a comment about a finalization issue gcc/ada/ * sem_ch5.adb (Analyze_Loop_Statement): Add a comment about a finalization issue. --- gcc/ada/sem_ch5.adb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 66315ad385e4..f4301397881a 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -4056,6 +4056,12 @@ package body Sem_Ch5 is -- range requires the secondary stack. In this case the loop is -- wrapped within a block in order to manage the secondary stack. + -- ??? This overlooks finalization: the loop may leave the secondary + -- stack untouched, but its iterator or discrete range may need + -- finalization, in which case the block is also required. Therefore + -- the criterion must be based on Sem_Util.Requires_Transient_Scope, + -- which happens to be what is currently implemented. + if Present (Iter) then declare Stop_Processing : Boolean; -- GitLab