From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id B8D5C3857810; Wed, 13 Mar 2024 15:38:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8D5C3857810 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710344333; bh=qXtwrqfRkGwQRguqDVl5yJg1K2KxJQqvNEbuzf7GpKU=; h=From:To:Subject:Date:From; b=pBAcr2eFyvB8DeBHTIN6W+QCD/Mbno4ddjdVhjZYu+ccO6MYlry9075zDeezGK9kg mvfbGGD+ukJfG53MxDWedVo79nZ+wVVDGxgRnn0TF2NkHaMr8l2Ot8xlX8N4ixOPMZ sk+RcZnqHOkXOrv/pKi+G7Dtafj8N5g2NMI8yQ1k= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-8434] ada: Fix incorrect handling of Aggregate aspect X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 1277f69b9b020688618bd034d3ceb03395e84326 X-Git-Newrev: bc97504e021fd8719fa6d9e31c311b38e87a3900 Message-Id: <20240313153853.B8D5C3857810@sourceware.org> Date: Wed, 13 Mar 2024 15:38:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bc97504e021fd8719fa6d9e31c311b38e87a3900 commit r13-8434-gbc97504e021fd8719fa6d9e31c311b38e87a3900 Author: Marc Poulhiès 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;