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-646] [Ada] Fix invalid expanded code for entry families
Date: Thu, 19 May 2022 14:07:20 +0000 (GMT)	[thread overview]
Message-ID: <20220519140720.10072385703E@sourceware.org> (raw)

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

commit r13-646-gca03325fb3a5fbf9c8af853d4c7f199e1adb08e3
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Apr 12 22:22:40 2022 +0200

    [Ada] Fix invalid expanded code for entry families
    
    Expansion of entry families created a slightly illegal AST with
    Elsif_Parts being an empty list. Cleanup uncovered by the work on
    detection of uninitialized scalars.
    
    gcc/ada/
    
            * exp_ch9.adb (Build_Find_Body_Index): Remove empty Elsif_Parts
            from the constructed IF statement.

Diff:
---
 gcc/ada/exp_ch9.adb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index f9bdaf80c94..be791c3a338 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -2800,6 +2800,15 @@ package body Exp_Ch9 is
             begin
                Remove (Nod);
                Set_Else_Statements (Ret, Then_Statements (Nod));
+
+               --  If Elsif_Parts becomes empty then remove it entirely, as
+               --  otherwise we would violate the invariant of If_Statement
+               --  node described in Sinfo.
+
+               if Is_Empty_List (Elsif_Parts (Ret)) then
+                  pragma Assert (Elsif_Parts (Ret) /= No_List);
+                  Set_Elsif_Parts (Ret, No_List);
+               end if;
             end;
          end if;
       end if;


                 reply	other threads:[~2022-05-19 14:07 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=20220519140720.10072385703E@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).