public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2614] ada: Apply correct element type for container aggregates
@ 2023-07-18 13:13 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-07-18 13:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:99c419b2a8ce033e8be08f656edd350d97f72125
commit r14-2614-g99c419b2a8ce033e8be08f656edd350d97f72125
Author: Viljar Indus <indus@adacore.com>
Date: Wed Jul 5 14:21:50 2023 +0300
ada: Apply correct element type for container aggregates
When dealing with a container aggregate with an iterator
specification the iterator should take the value of the
element of the container instead of the key.
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Association): Use the element
type for the iterator in a container aggregate with an iterator
specification.
Diff:
---
gcc/ada/sem_aggr.adb | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 5bfbde5052b..ecd508a66f8 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -3228,6 +3228,8 @@ package body Sem_Aggr is
Analyze_And_Resolve (New_Copy_Tree (Key_Expr), Key_Type);
End_Scope;
+ Typ := Key_Type;
+
elsif Present (Iterator_Specification (Comp)) then
Copy := Copy_Separate_Tree (Iterator_Specification (Comp));
Id_Name :=
@@ -3252,7 +3254,7 @@ package body Sem_Aggr is
elsif Present (Key_Type) then
Analyze_And_Resolve (Choice, Key_Type);
-
+ Typ := Key_Type;
else
Typ := Etype (Choice); -- assume unique for now
end if;
@@ -3282,12 +3284,8 @@ package body Sem_Aggr is
Enter_Name (Id);
- if No (Key_Type) then
- pragma Assert (Present (Typ));
- Set_Etype (Id, Typ);
- else
- Set_Etype (Id, Key_Type);
- end if;
+ pragma Assert (Present (Typ));
+ Set_Etype (Id, Typ);
Mutate_Ekind (Id, E_Variable);
Set_Is_Not_Self_Hidden (Id);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-18 13:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 13:13 [gcc r14-2614] ada: Apply correct element type for container aggregates Marc Poulhi?s
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).