From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 485E6385771B; Fri, 15 Sep 2023 13:05:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 485E6385771B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694783115; bh=yxr5WcutKl2iTUmEPN+pfuBjKY896ilZ7mVbwS7VJGU=; h=From:To:Subject:Date:From; b=j2mk6YSFdYdAWjENbOJ/WbKImcoUWfhzEm/FlXyEa0ytTN5EI9xA+bU647TGXVJLE hhyNK+mSJYISkLqUBUsstqwALqXxbEpBAwyvj53t9YvZ9fv0fHhWP1s2UXeGFHNdpb ujE8gVdxLQinN7G9pDPaJ6CnQ6xWA6jD3TSA62qc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4032] ada: Explicitly analyze and expand null array aggregates X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: b96446e0d0afd0d817f6206efabb1deed4e1ed8e X-Git-Newrev: d9275e87812a65474be63d565ae4a2eb9a43e9b1 Message-Id: <20230915130515.485E6385771B@sourceware.org> Date: Fri, 15 Sep 2023 13:05:15 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d9275e87812a65474be63d565ae4a2eb9a43e9b1 commit r14-4032-gd9275e87812a65474be63d565ae4a2eb9a43e9b1 Author: Piotr Trojanek Date: Thu Sep 7 22:13:51 2023 +0200 ada: Explicitly analyze and expand null array aggregates Null array aggregates have present but empty lists of expressions and component associations. This confuses the previous code for ordinary array aggregates, which assumes that if a list of either expressions or component associations is present, then it is non-empty. This patch adds explicit handling for null array aggregates to avoid assertion failures in code for ordinary array aggregates. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code): Don't build aggregate code for null array aggregates. * sem_aggr.adb (Resolve_Array_Aggregate): Don't examine formatting of a null array aggregate. Diff: --- gcc/ada/exp_aggr.adb | 5 ++++- gcc/ada/sem_aggr.adb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index d72e27030e5..165f517c031 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -1989,7 +1989,10 @@ package body Exp_Aggr is -- Skip this if no component associations - if No (Expressions (N)) then + if Is_Null_Aggregate (N) then + null; + + elsif No (Expressions (N)) then -- STEP 1 (a): Sort the discrete choices diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index e929fea3bb6..597c3ce2dd1 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2081,7 +2081,10 @@ package body Sem_Aggr is -- STEP 1: make sure the aggregate is correctly formatted - if Present (Component_Associations (N)) then + if Is_Null_Aggregate (N) then + null; + + elsif Present (Component_Associations (N)) then -- Verify that all or none of the component associations -- include an iterator specification.