From 86203b44de9b6a3394816207728155164ea2caa0 Mon Sep 17 00:00:00 2001
From: Piotr Trojanek <trojanek@adacore.com>
Date: Thu, 7 Jan 2021 12:14:42 +0100
Subject: [PATCH] [Ada] Fix inconsistent iteration with First_Formal and
 Next_Entity

gcc/ada/

	* sem_ch12.adb (Check_Abstract_Primitives): Match First_Formal
	with Next_Formal.
	* sem_ch6.adb (Is_Non_Overriding_Operation): Likewise.
---
 gcc/ada/sem_ch12.adb | 4 ++--
 gcc/ada/sem_ch6.adb  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 47610155fc2e..f635f2564799 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -13682,8 +13682,8 @@ package body Sem_Ch12 is
                                     exit;
                                  end if;
 
-                                 Next_Entity (Anc_Formal);
-                                 Next_Entity (Act_Formal);
+                                 Next_Formal (Anc_Formal);
+                                 Next_Formal (Act_Formal);
                               end loop;
 
                               --  If we traversed through all of the formals
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index cd3fd11743db..a53540d5c3d1 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -10713,8 +10713,8 @@ package body Sem_Ch6 is
                            exit;
                         end if;
 
-                        Next_Entity (P_Formal);
-                        Next_Entity (N_Formal);
+                        Next_Formal (P_Formal);
+                        Next_Formal (N_Formal);
                      end loop;
 
                      --  Found a matching primitive operation belonging to the
-- 
GitLab