[Ada] Fix crash on quantified expression in expression function

gcc/ada/

	* einfo.adb (Write_Field24_Name): Handle E_Loop_Parameter.
	* freeze.adb (Freeze_Expr_Types): Freeze the iterator type used as
	Default_Iterator of the name of an N_Iterator_Specification node.
This commit is contained in:
Eric Botcazou 2020-05-26 12:55:26 +02:00 committed by Pierre-Marie de Rodat
parent b898963124
commit a042b9c680
2 changed files with 17 additions and 0 deletions

View File

@ -10969,6 +10969,7 @@ package body Einfo is
when Type_Kind
| E_Constant
| E_Loop_Parameter
| E_Variable
=>
Write_Str ("Related_Expression");

View File

@ -7990,6 +7990,22 @@ package body Freeze is
and then Nkind (Parent (Node)) = N_Explicit_Dereference
then
Check_And_Freeze_Type (Designated_Type (Etype (Node)));
-- An iterator specification freezes the iterator type, even though
-- that type is not attached to an entity in the construct.
elsif Nkind (Node) in N_Has_Etype
and then Nkind (Parent (Node)) = N_Iterator_Specification
and then Node = Name (Parent (Node))
then
declare
Iter : constant Node_Id :=
Find_Aspect (Etype (Node), Aspect_Default_Iterator);
begin
if Present (Iter) then
Check_And_Freeze_Type (Etype (Expression (Iter)));
end if;
end;
end if;
-- No point in posting several errors on the same expression