public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-486] [Ada] Fix internal error on iterated array aggregate
Date: Mon, 16 May 2022 08:43:52 +0000 (GMT)	[thread overview]
Message-ID: <20220516084352.9186D385780F@sourceware.org> (raw)

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

commit r13-486-ge4acb82e97f8043dcd5e6b91b7d3c05d7b478b45
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Mar 10 00:31:11 2022 +0100

    [Ada] Fix internal error on iterated array aggregate
    
    The front-end drops the declaration of a temporary on the floor because
    Insert_Actions fails to climb up out of an N_Iterated_Component_Association
    when the temporary is created during the analysis of its Discrete_Choices.
    
    gcc/ada/
    
            * exp_util.adb (Insert_Actions) <N_Iterated_Component_Association>:
            Climb up out of the node if the actions come from Discrete_Choices.

Diff:
---
 gcc/ada/exp_util.adb | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 4198ceaa5b3..d3fbc4bc644 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -7751,12 +7751,17 @@ package body Exp_Util is
 
                  --  We must not climb up out of an N_Iterated_xxx_Association
                  --  because the actions might contain references to the loop
-                 --  parameter. But it turns out that setting the Loop_Actions
-                 --  attribute in the case of an N_Component_Association
-                 --  when the attribute was not already set can lead to
-                 --  (as yet not understood) bugboxes (gcc failures that are
-                 --  presumably due to malformed trees). So we don't do that.
-
+                 --  parameter, except if we come from the Discrete_Choices of
+                 --  N_Iterated_Component_Association which cannot contain any.
+                 --  But it turns out that setting the Loop_Actions field in
+                 --  the case of an N_Component_Association when the field was
+                 --  not already set can lead to gigi assertion failures that
+                 --  are presumably due to malformed trees, so don't do that.
+
+                 and then (Nkind (P) /= N_Iterated_Component_Association
+                            or else not Is_List_Member (N)
+                            or else
+                              List_Containing (N) /= Discrete_Choices (P))
                  and then (Nkind (P) /= N_Component_Association
                             or else Present (Loop_Actions (P)))
                then


                 reply	other threads:[~2022-05-16  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516084352.9186D385780F@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).