diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-05-26 12:55:26 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-10 05:16:17 -0400 |
commit | a042b9c6809a23bfb71676646a8c28b1e8e1249f (patch) | |
tree | 3ba15ce26f21b3ee05bc202390652ffe5885b2ae /gcc | |
parent | b89896312467947542a6eebee886d182e6508760 (diff) | |
download | gcc-a042b9c6809a23bfb71676646a8c28b1e8e1249f.zip gcc-a042b9c6809a23bfb71676646a8c28b1e8e1249f.tar.gz gcc-a042b9c6809a23bfb71676646a8c28b1e8e1249f.tar.bz2 |
[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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/einfo.adb | 1 | ||||
-rw-r--r-- | gcc/ada/freeze.adb | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index c2a2e14d..8650542 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -10969,6 +10969,7 @@ package body Einfo is when Type_Kind | E_Constant + | E_Loop_Parameter | E_Variable => Write_Str ("Related_Expression"); diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 4b58b75..6620ae3 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -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 |