From patchwork Thu May 19 14:16:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54217 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B8993876079 for ; Thu, 19 May 2022 14:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B8993876079 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652970438; bh=BhpTcDUat+Kecb6oUnJ/GPyxJA640qzstTqlSTxp3aU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=QQ0esKwWR5DPSJ4GkDGkhV9HEKlL986RIws1XQ5TvFWU7xPdiO3/JqbRzC32OhSN9 gXaacAi9ZxPLHGh7pbiL6Y5gH2SL8vkiUnnmQu30KU5Zl+MHOebZalv3zCC2nXFmvP 2VSouvlSx/FstUZmS79tX1ywAQPtHTAF27pF/IYU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 2B659383D832 for ; Thu, 19 May 2022 14:16:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B659383D832 Received: by mail-wm1-x331.google.com with SMTP id i20-20020a05600c355400b0039456976dcaso3615731wmq.1 for ; Thu, 19 May 2022 07:16:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=BhpTcDUat+Kecb6oUnJ/GPyxJA640qzstTqlSTxp3aU=; b=FK6fE0hgtnYIgTl+xNutKbUjd1r2LlmpHP2C46ubl0fGQ+5uxqYYXva20g7AqpVMVW ZGPAcRB4ULBCl1R4rnpu6/OKTulEnE2a0GNQ+S1YIn9sixqGmtit651mMdcrUJ3qCxrV JHnN9Vmmhq5BHrlNEv98wwb+hl2wDWLDmEObNrkAvwqwsCo92We4bMUHEK29XntTU9sB My1Fu4RUu+BY0AErA9g041AOSBgpd8RZd6XBp04l39uO5Kd1iGKGKOMwPKVVlAb5obvE NSB1OSwjvoi25Z8+tAPUnWoWK8M3hyN8iieu/9bBsvoNuEF/RudduAFkmZXawv0tOpn4 HYaQ== X-Gm-Message-State: AOAM532jaT7Qz7Qq6KVopRgLsQj/EfGz0qYcND3NITAFBx5rifyvrGCs X/sfIKb7QWKHnEvl8aVpaIpdwDHQpZ3LlQ== X-Google-Smtp-Source: ABdhPJybYXx5jgpP7KIf5xabXJBhbcIt6BLyGo+02OKTj8NQb857iW4pbTT89OzsXgDC+YvaJjVvew== X-Received: by 2002:a1c:f415:0:b0:397:2db0:ed73 with SMTP id z21-20020a1cf415000000b003972db0ed73mr3092980wma.19.1652969766868; Thu, 19 May 2022 07:16:06 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id e25-20020adfa459000000b0020c5253d8dcsm5182966wra.40.2022.05.19.07.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 07:16:06 -0700 (PDT) Date: Thu, 19 May 2022 14:16:05 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix invalid expanded code for entry families Message-ID: <20220519141605.GA3723246@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch9.adb (Build_Find_Body_Index): Remove empty Elsif_Parts from the constructed IF statement. diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb --- 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;