public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2128] ada: Fix incorrect handling of iterator specifications in recent change
@ 2023-06-27 12:08 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-06-27 12:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d47dbbd22fcb4fd26f7a9b66bd99dcf4518deea9

commit r14-2128-gd47dbbd22fcb4fd26f7a9b66bd99dcf4518deea9
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Jun 16 10:13:46 2023 +0200

    ada: Fix incorrect handling of iterator specifications in recent change
    
    Unlike for loop parameter specifications where it references an index, the
    defining identifier references an element in them.
    
    gcc/ada/
    
            * sem_ch12.adb (Check_Generic_Actuals): Check the component type
            of constants and variables of an array type.
            (Copy_Generic_Node): Fix bogus handling of iterator
            specifications.

Diff:
---
 gcc/ada/sem_ch12.adb | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 43fcff2c9d5..61e0ec47392 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -7192,11 +7192,16 @@ package body Sem_Ch12 is
             Set_Is_Hidden (E, False);
          end if;
 
-         --  Check directly the type of the actual objects
+         --  Check directly the type of the actual objects, including the
+         --  component type for array types.
 
          if Ekind (E) in E_Constant | E_Variable then
             Check_Actual_Type (Etype (E));
 
+            if Is_Array_Type (Etype (E)) then
+               Check_Actual_Type (Component_Type (Etype (E)));
+            end if;
+
          --  As well as the type of formal parameters of actual subprograms
 
          elsif Ekind (E) in E_Function | E_Procedure
@@ -8520,13 +8525,12 @@ package body Sem_Ch12 is
             Copy_Descendants;
          end;
 
-      --  Iterator and loop parameter specifications do not have an identifier
-      --  denoting the index type, so we must locate it through the expression
-      --  to check whether the views are consistent.
+      --  Loop parameter specifications do not have an identifier denoting the
+      --  index type, so we must locate it through the defining identifier to
+      --  check whether the views are consistent.
 
-      elsif Nkind (N) in N_Iterator_Specification
-                       | N_Loop_Parameter_Specification
-         and then Instantiating
+      elsif Nkind (N) = N_Loop_Parameter_Specification
+        and then Instantiating
       then
          declare
             Id : constant Entity_Id :=

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-27 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 12:08 [gcc r14-2128] ada: Fix incorrect handling of iterator specifications in recent change 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).