More work on this AI. Replace the Put_Image procedures in
Ada.Containers.Indefinite_Vectors and Indefinite_Doubly_Linked_Lists
with versions that call procedure Iterate, rather than using a
"for ... of" loop, because the "for ... of" loop causes regressions.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * libgnat/a-coinve.adb, libgnat/a-cidlli.adb (Put_Image): Call
        Iterate.
diff --git a/gcc/ada/libgnat/a-cidlli.adb b/gcc/ada/libgnat/a-cidlli.adb
--- a/gcc/ada/libgnat/a-cidlli.adb
+++ b/gcc/ada/libgnat/a-cidlli.adb
@@ -1307,19 +1307,22 @@ is
    is
       First_Time : Boolean := True;
       use System.Put_Images;
-   begin
-      Array_Before (S);
 
-      for X of V loop
+      procedure Put_Elem (Position : Cursor);
+      procedure Put_Elem (Position : Cursor) is
+      begin
          if First_Time then
             First_Time := False;
          else
             Simple_Array_Between (S);
          end if;
 
-         Element_Type'Put_Image (S, X);
-      end loop;
+         Element_Type'Put_Image (S, Element (Position));
+      end Put_Elem;
 
+   begin
+      Array_Before (S);
+      Iterate (V, Put_Elem'Access);
       Array_After (S);
    end Put_Image;
 


diff --git a/gcc/ada/libgnat/a-coinve.adb b/gcc/ada/libgnat/a-coinve.adb
--- a/gcc/ada/libgnat/a-coinve.adb
+++ b/gcc/ada/libgnat/a-coinve.adb
@@ -2659,19 +2659,22 @@ is
    is
       First_Time : Boolean := True;
       use System.Put_Images;
-   begin
-      Array_Before (S);
 
-      for X of V loop
+      procedure Put_Elem (Position : Cursor);
+      procedure Put_Elem (Position : Cursor) is
+      begin
          if First_Time then
             First_Time := False;
          else
             Simple_Array_Between (S);
          end if;
 
-         Element_Type'Put_Image (S, X);
-      end loop;
+         Element_Type'Put_Image (S, Element (Position));
+      end Put_Elem;
 
+   begin
+      Array_Before (S);
+      Iterate (V, Put_Elem'Access);
       Array_After (S);
    end Put_Image;
 


Reply via email to