From patchwork Mon Oct 4 08:47:30 2021 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: 1535989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tIaNRsA9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNDsR4bryz9sP7 for ; Mon, 4 Oct 2021 19:48:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF81A3858423 for ; Mon, 4 Oct 2021 08:48:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF81A3858423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633337337; bh=Jb6t53AQnv6IPESN0jhMzQBAO9jDvgtVtm96zR6Qbow=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=tIaNRsA9HEV0ZnMSkUmhP5ADgCcuX61/uzg/iIlM+0etxGIHu0oREQwzoou1KhrAm d4/xLV/AGqtGro/HtAkc9HOU49Jg9kIqCv3FrHH+S/7SO4loq3aLru8miPw+kssdOF XFEwPhlNtvau87SXgH8vtgxt0SoUkjBGCct3KLGY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 6D0923858439 for ; Mon, 4 Oct 2021 08:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D0923858439 Received: by mail-lf1-x12b.google.com with SMTP id u18so68687004lfd.12 for ; Mon, 04 Oct 2021 01:47:33 -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=Jb6t53AQnv6IPESN0jhMzQBAO9jDvgtVtm96zR6Qbow=; b=xkFb+awBIv5nTu7iujeAPWfSKvZyc7zEXjMU0YuPFpRbd9q+ebTAryV5V6A2O4Gdrt kLqVjf+tZpcyjOcMilUiU0N+PMZWB/Xi5yC9sMcJEtJ/23MOw3kqvJIFoDtGxNwUsYhh IGTmM5QzYrqYipAsffsQQFQgcGpWbHeI/ZW5R0xK3c7J6Ra1lSRk4c6a/xXoT9OEdSfR pmKFh14gCYce34f5M9nuc7RV1CR3tPea4PtB869mwz5WYEbrp7HxQNQ888PtlvthRvZs 7q6CTNZW3YfjNNeDkWPKlnjKcKXZZmRKWL2Qb3vtDVCFXHFo6J5MaHV70JPa0FhVaVrm 8VJw== X-Gm-Message-State: AOAM532osKDcLV4YnmHAEwiz4dV2R8ZpsqMKOP+epWwnss8ZgZLKd5YY gPEYUB/rXiJIyo40zF0GAdc6UkvXeYasSw== X-Google-Smtp-Source: ABdhPJwqYh91s0091d+eJagMdGiQt85D1RdwqVw6pIKgNK3OCBTSOdAQRaCcD2xybq/dAIXM0mxXTg== X-Received: by 2002:a05:651c:a0a:: with SMTP id k10mr6148201ljq.504.1633337252206; Mon, 04 Oct 2021 01:47:32 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id m5sm1548425lfg.121.2021.10.04.01.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 01:47:31 -0700 (PDT) Date: Mon, 4 Oct 2021 08:47:30 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix compiler internal error Message-ID: <20211004084730.GA1536154@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Steve Baird Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" In some cases with -gnat2022 enabled, an enabled postcondition containing a quantified expression containing an Old attribute reference could result in an internal error during compilation. Fix this. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Is_Repeatedly_Evaluated): Handle the case of an Old attribute reference that occurs within what was originally a quantified expression but which expansion has transformed into an Expression_With_Actions. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -31510,7 +31510,12 @@ package body Sem_Util is -- quantified_expression. if Nkind (Par) = N_Quantified_Expression - and then Trailer = Condition (Par) + and then Trailer = Condition (Par) + then + return True; + elsif Nkind (Par) = N_Expression_With_Actions + and then + Nkind (Original_Node (Par)) = N_Quantified_Expression then return True; end if;