https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121968
--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This is sufficient to fix the assertion failure:
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -1273,7 +1273,9 @@ package body Sem_Dim is
-- Get the expression from the component
- if Nkind (Comp) = N_Component_Association then
+ if Nkind (Comp) in N_Component_Association
+ | N_Iterated_Component_Association
+ then
Expr := Expression (Comp);
else
Expr := Comp;
