[Ada] Add a comment about a finalization issue
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 6 May 2022 14:56:41 +0000 (16:56 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 1 Jun 2022 08:43:18 +0000 (08:43 +0000)
gcc/ada/

* sem_ch5.adb (Analyze_Loop_Statement): Add a comment about
a finalization issue.

gcc/ada/sem_ch5.adb

index 66315ad..f430139 100644 (file)
@@ -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;