From: Piotr Trojanek <troja...@adacore.com> When detecting controlling formals we are only interested in formal parameters and not in other entities.
gcc/ada/ * sem_ch6.adb (Controlling_Formal): Iterate with First/Next_Formal and not with First/Next_Entity. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch6.adb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 228adcff5cd..d28de10d3d6 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10711,13 +10711,13 @@ package body Sem_Ch6 is E : Entity_Id; begin - E := First_Entity (Prim); + E := First_Formal (Prim); while Present (E) loop - if Is_Formal (E) and then Is_Controlling_Formal (E) then + if Is_Controlling_Formal (E) then return E; end if; - Next_Entity (E); + Next_Formal (E); end loop; return Empty; -- 2.34.1