aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/exp_aggr.adb13
-rw-r--r--gcc/ada/par-ch4.adb1
-rw-r--r--gcc/ada/sem_aggr.adb3
-rw-r--r--gcc/ada/sem_elab.adb4
-rw-r--r--gcc/ada/sem_res.adb18
-rw-r--r--gcc/ada/sem_util.adb3
-rw-r--r--gcc/ada/sinfo.ads12
7 files changed, 41 insertions, 13 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 4493f0f..157b01e 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6536,7 +6536,7 @@ package body Exp_Aggr is
Prefix => New_Occurrence_Of (TmpE, Loc),
Expressions =>
New_List (New_Occurrence_Of (Index_Id, Loc))),
- Expression => New_Copy_Tree (Expression (Assoc)));
+ Expression => Copy_Separate_Tree (Expression (Assoc)));
-- Advance index position for insertion.
@@ -7500,11 +7500,11 @@ package body Exp_Aggr is
-- Iterated_Component_Association.
- Loop_Id :=
- Make_Defining_Identifier (Loc,
- Chars => Chars (Defining_Identifier (Comp)));
-
if Present (Iterator_Specification (Comp)) then
+ Loop_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier
+ (Iterator_Specification (Comp))));
L_Iteration_Scheme :=
Make_Iteration_Scheme (Loc,
Iterator_Specification => Iterator_Specification (Comp));
@@ -7513,6 +7513,9 @@ package body Exp_Aggr is
-- Loop_Parameter_Specification is parsed with a choice list.
-- where the range is the first (and only) choice.
+ Loop_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier (Comp)));
L_Range := Relocate_Node (First (Discrete_Choices (Comp)));
L_Iteration_Scheme :=
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 4ab4dcb..9a00d7b 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -3554,7 +3554,6 @@ package body Ch4 is
when Tok_Of =>
Restore_Scan_State (State);
Scan; -- past OF
- Set_Defining_Identifier (Assoc_Node, Id);
Iter_Spec := P_Iterator_Specification (Id);
Set_Iterator_Specification (Assoc_Node, Iter_Spec);
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index ce3e2f4..8f20b3a 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -3053,7 +3053,8 @@ package body Sem_Aggr is
elsif Present (Iterator_Specification (Comp)) then
Copy := Copy_Separate_Tree (Iterator_Specification (Comp));
- Id_Name := Chars (Defining_Identifier (Comp));
+ Id_Name :=
+ Chars (Defining_Identifier (Iterator_Specification (Comp)));
Analyze (Copy);
Typ := Etype (Defining_Identifier (Copy));
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 077c988..c530392 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -3339,7 +3339,9 @@ package body Sem_Elab is
Traverse_List (Else_Actions (Scen));
elsif Nkind (Scen) in
- N_Component_Association | N_Iterated_Component_Association
+ N_Component_Association
+ | N_Iterated_Component_Association
+ | N_Iterated_Element_Association
then
Traverse_List (Loop_Actions (Scen));
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 44fc955..f618467 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3163,9 +3163,21 @@ package body Sem_Res is
= N_Iterated_Component_Association
and then Is_Boolean_Type (Typ)
then
- Error_Msg_N -- CODEFIX
- ("missing ALL or SOME in quantified expression",
- Defining_Identifier (First (Component_Associations (N))));
+ if Present
+ (Iterator_Specification
+ (First (Component_Associations (N))))
+ then
+ Error_Msg_N -- CODEFIX
+ ("missing ALL or SOME in quantified expression",
+ Defining_Identifier
+ (Iterator_Specification
+ (First (Component_Associations (N)))));
+ else
+ Error_Msg_N -- CODEFIX
+ ("missing ALL or SOME in quantified expression",
+ Defining_Identifier
+ (First (Component_Associations (N))));
+ end if;
-- For an operator with no interpretation, check whether
-- one of its operands may be a user-defined literal.
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 13ffb11..e3e42c8 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -29500,6 +29500,9 @@ package body Sem_Util is
when N_Iterated_Component_Association =>
Traverse_More (Loop_Actions (Node), Result);
+ when N_Iterated_Element_Association =>
+ Traverse_More (Loop_Actions (Node), Result);
+
when N_Iteration_Scheme =>
Traverse_More (Condition_Actions (Node), Result);
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index ddac1c9..fddfc72 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -4183,11 +4183,15 @@ package Sinfo is
-- ITERATED_COMPONENT_ASSOCIATION ::=
-- for DEFINING_IDENTIFIER in DISCRETE_CHOICE_LIST => EXPRESSION
+ -- for ITERATOR_SPECIFICATION => EXPRESSION
+
+ -- At most one of (Defining_Identifier, Iterator_Specification)
+ -- is present at a time, in which case the other one is empty.
-- N_Iterated_Component_Association
-- Sloc points to FOR
-- Defining_Identifier
- -- Iterator_Specification (set to Empty if no Iterator_Spec)
+ -- Iterator_Specification
-- Expression
-- Discrete_Choices
-- Loop_Actions
@@ -4207,9 +4211,13 @@ package Sinfo is
-- Etype
---------------------------------
- -- 3.4.5 Comtainer_Aggregates --
+ -- 3.4.5 Container_Aggregates --
---------------------------------
+ -- ITERATED_ELEMENT_ASSOCIATION ::=
+ -- for LOOP_PARAMETER_SPECIFICATION[ use KEY_EXPRESSION] => EXPRESSION
+ -- | for ITERATOR_SPECIFICATION[ use KEY_EXPRESSION] => EXPRESSION
+
-- N_Iterated_Element_Association
-- Key_Expression
-- Iterator_Specification