aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-10-15 21:41:45 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-11-04 16:57:58 +0100
commit56ea463808d47cc8bf342b32125e793cfcde472d (patch)
tree280f56b194450ff56fc314d517234c087a8c2187
parent4fbfd9e686eeb02466581a87f151dfe20f140f13 (diff)
downloadgcc-56ea463808d47cc8bf342b32125e793cfcde472d.zip
gcc-56ea463808d47cc8bf342b32125e793cfcde472d.tar.gz
gcc-56ea463808d47cc8bf342b32125e793cfcde472d.tar.bz2
ada: Propagate resolution status from Resolve_Iterated_Component_Association
The resolution status of Resolve_Aggr_Expr is lost when the routine is invoked indirectly from Resolve_Iterated_Component_Association. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Iterated_Component_Association): Change to function returning Boolean and return the result of the call made to Resolve_Aggr_Expr. (Resolve_Array_Aggregate): Return failure status if the call to Resolve_Iterated_Component_Association returns false.
-rw-r--r--gcc/ada/sem_aggr.adb23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 9439d64..b05b0b2 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1646,10 +1646,11 @@ package body Sem_Aggr is
-- node as Expr, since there is no Expression and we need a Sloc for the
-- error message.
- procedure Resolve_Iterated_Component_Association
+ function Resolve_Iterated_Component_Association
(N : Node_Id;
- Index_Typ : Entity_Id);
- -- For AI12-061
+ Index_Typ : Entity_Id) return Boolean;
+ -- For AI12-061: resolves iterated component association N of Index_Typ.
+ -- Returns False if resolution fails.
function Subtract (Val : Uint; To : Node_Id) return Node_Id;
-- Creates a new expression node where Val is subtracted to expression
@@ -2110,9 +2111,9 @@ package body Sem_Aggr is
-- Resolve_Iterated_Component_Association --
--------------------------------------------
- procedure Resolve_Iterated_Component_Association
+ function Resolve_Iterated_Component_Association
(N : Node_Id;
- Index_Typ : Entity_Id)
+ Index_Typ : Entity_Id) return Boolean
is
Loc : constant Source_Ptr := Sloc (N);
Id : constant Entity_Id := Defining_Identifier (N);
@@ -2217,10 +2218,6 @@ package body Sem_Aggr is
Resolution_OK := Resolve_Aggr_Expr (Expr, Single_Elmt => False);
- if not Resolution_OK then
- return;
- end if;
-
if Operating_Mode /= Check_Semantics then
Remove_References (Expr);
declare
@@ -2235,6 +2232,8 @@ package body Sem_Aggr is
end if;
End_Scope;
+
+ return Resolution_OK;
end Resolve_Iterated_Component_Association;
--------------
@@ -2659,7 +2658,11 @@ package body Sem_Aggr is
Assoc := First (Component_Associations (N));
while Present (Assoc) loop
if Nkind (Assoc) = N_Iterated_Component_Association then
- Resolve_Iterated_Component_Association (Assoc, Index_Typ);
+ if not Resolve_Iterated_Component_Association
+ (Assoc, Index_Typ)
+ then
+ return Failure;
+ end if;
elsif Nkind (Assoc) /= N_Component_Association then
Error_Msg_N