From patchwork Thu May 19 14:16:04 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: 54216 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 F06593839C5F for ; Thu, 19 May 2022 14:26:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F06593839C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652970381; bh=Op64U+vqNgXtyUXQtwT+MUYu8lNYTgT9uI7BfbRqNNc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=n7mABu2FqvdoAolqY3JGyXwwweuuRODdYJT/SX9OluRTkbm3rKK3RQzCQw9J1QYq4 D1y5229MfFV2XLtTfYQnBBKarQAJ+vKqIhrOIXwqYwNZYoEGLP9Z4cttxzILiT/M0Z 6x04KIzK/JTEtEFhcjYRjP7s4H6GMkt8XRx79ncs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 413FC383D833 for ; Thu, 19 May 2022 14:16:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 413FC383D833 Received: by mail-wr1-x431.google.com with SMTP id s28so7254724wrb.7 for ; Thu, 19 May 2022 07:16:07 -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=Op64U+vqNgXtyUXQtwT+MUYu8lNYTgT9uI7BfbRqNNc=; b=wgvU3FTQNagVkiR0EIgRmP1qA7R1jXAZ4U/t/XJil8Y5ykyHrjSJERgZfZm1DhiN85 g6vaM4QPYB+xKflp2j25H/+UvltEDH6dK8QcW1a1Mn7WuVKAdJJXqZOOv1sQGa/dUo2Q vzp61/MdPDanvYtfZW6RdxPCgwcclpZux2TEsepPopMnMCfnQw6DvSMLnLvX0rNSVrc6 2N86Uggpi7bakjWQ7oAjy6/Wcin5nQwQfENDs467U68dlSHsr6rXeCLMF0HwnKArA57I joLgOB1/XPmaUmUdYJ0OBFdfJc/obRwrm//6Y2yJg0qlWY4b9guGlAv2lg/44wChJV+R ziOA== X-Gm-Message-State: AOAM531OpuWGSYAKdNmjQT8y3AZPwU/E/jFYbgosNFwwijQTHpLaPlZZ Ezr/NvX4YxN2PEM1b1muI1/5hpMe/1mhRw== X-Google-Smtp-Source: ABdhPJx7ttcBUA9Iv+Ainquv4Twal0q3vG9RkFbEjM4n4k6jyg/CLndxEDlYQzqUisiN8rHosHxZmw== X-Received: by 2002:a05:6000:154b:b0:20c:4cc7:91b3 with SMTP id 11-20020a056000154b00b0020c4cc791b3mr4357723wry.421.1652969765511; Thu, 19 May 2022 07:16:05 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id h21-20020a05600c351500b003971ece4e8bsm4574594wmq.13.2022.05.19.07.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 07:16:04 -0700 (PDT) Date: Thu, 19 May 2022 14:16:04 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Cleanup expansion of protected entry families Message-ID: <20220519141604.GA3723225@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 contained a condition that was always true. Cleanup related to detection of uninitialized scalar objects (which uncovered that expansion of entry families creates a slightly illegal AST with Elsif_Parts being an empty list). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch9.adb (Build_Find_Body_Index): Remove IF statement whose condition was true-by-construction; remove excessive assertion (since the call to Elsif_Parts will check that Nod is present and it is an 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 @@ -2793,20 +2793,14 @@ package body Exp_Ch9 is Expression => Make_Integer_Literal (Loc, 1)); else - pragma Assert (Present (Ret)); + -- Ranges are in increasing order, so last one doesn't need guard - if Nkind (Ret) = N_If_Statement then - - -- Ranges are in increasing order, so last one doesn't need - -- guard. - - declare - Nod : constant Node_Id := Last (Elsif_Parts (Ret)); - begin - Remove (Nod); - Set_Else_Statements (Ret, Then_Statements (Nod)); - end; - end if; + declare + Nod : constant Node_Id := Last (Elsif_Parts (Ret)); + begin + Remove (Nod); + Set_Else_Statements (Ret, Then_Statements (Nod)); + end; end if; end if;