public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8434] ada: Fix incorrect handling of Aggregate aspect
@ 2024-03-13 15:38 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2024-03-13 15:38 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-8434-gbc97504e021fd8719fa6d9e31c311b38e87a3900
Author: Marc Poulhiès <poulhies@adacore.com>
Date:   Tue Feb 28 17:10:29 2023 +0100

    ada: Fix incorrect handling of Aggregate aspect
    
    This change fixes 2 incorrect handlings of the aspect.
    The arguments are now correctly resolved and the aspect is rejected on
    non array types.
    
    gcc/ada/
    
            * sem_ch13.adb (Analyze_One_Aspect): Mark Aggregate aspect as
            needing delayed resolution and reject the aspect on non-array
            type.

Diff:
---
 gcc/ada/sem_ch13.adb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index b81b6b02e1d..317c4841d87 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -2921,10 +2921,10 @@ package body Sem_Ch13 is
             end case;
 
             if Delay_Required
-
                and then (A_Id = Aspect_Stable_Properties
                           or else A_Id = Aspect_Designated_Storage_Model
-                          or else A_Id = Aspect_Storage_Model_Type)
+                          or else A_Id = Aspect_Storage_Model_Type
+                          or else A_Id = Aspect_Aggregate)
                --  ??? It seems like we should do this for all aspects, not
                --  just these, but that causes as-yet-undiagnosed regressions.
 
@@ -4211,6 +4211,12 @@ package body Sem_Ch13 is
                   Aitem := Empty;
 
                when Aspect_Aggregate =>
+                  if Is_Array_Type (E) then
+                     Error_Msg_N
+                       ("aspect% can only be applied to non-array type", Id);
+                     goto Continue;
+                  end if;
+
                   Validate_Aspect_Aggregate (Expr);
                   Record_Rep_Item (E, Aspect);
                   goto Continue;

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

only message in thread, other threads:[~2024-03-13 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 15:38 [gcc r13-8434] ada: Fix incorrect handling of Aggregate aspect Eric Botcazou

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).