From patchwork Tue May 16 08:41:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 94540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp275476vqo; Tue, 16 May 2023 01:55:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QlMF0983gf9RPrwQLKZ5AJhgG8MhoSMuEZghz/ervW78tDAbdZMggVd1YM1EsDDrbnnqT X-Received: by 2002:a17:907:8a02:b0:967:d161:61c6 with SMTP id sc2-20020a1709078a0200b00967d16161c6mr28688162ejc.3.1684227327359; Tue, 16 May 2023 01:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684227327; cv=none; d=google.com; s=arc-20160816; b=N1hyVvBdqeJCG8Q8qiR7gQAy3F2Tqqio2aBRTPaA1rVaY3h9lJR7pXVKHk4A/pSw0E 7t1v9eyCgo4n42opkSLf60DVvTS3UoN8soFPRvSoM/5lSLd+BdxsRq0L1XVqd7L0Up0U MbjbT8xsV3C6fBMY+C8NjpIgADAKVpm7rLl5uRUVMB2xL4T+7vdS4+Blgwa0m3KG9OuJ 4SZtWJZtqXHVhyEA/JYgX5chMk3fNemOxktT2h4Ig4fp3O9Hmr58yh9HuzfrtF3fZ7gB hGYSvt2z1oPAENUXvDO1NOcjxazHFFOWCHvcGS6lsRGp89cOoQsvGRE2+do/Gfhp5oam MNdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=+eSzq0+ZndjT33wYhWhK0WJmxI+zaUGF9n6fixSCKPM=; b=0Zr3//JW5TkJ5Ex5V1BLCRm5EgdXE4JTeuHYL4TtJCpP6ZAi7yQekkNyAG/eKN6qwE sVR5h8pt1xtJjuhaNGQCpwSqWd1w/UXZE0S+nLw4jZqjZtzr2vahsDsOhYgujrN1c8WM FYcMRq0x2xo/gZ0v8oIq2RXi6F10EpJdrHkYux/iy/PSFgF6+xLV8kN70zWFFPfuZxml pl3rwn0spFC7KBiQMqTKTdsv+PLxzREcd3CulwLffQ4QDWC0cUFMN65ebGGTQgxpoj3Q g7GTfXJ9/Q2g8qTRfEWteu+So+bXP3/BQi1g0eXwbc+wEhSXQ/PXv4TQM57Dym+glZPE GbxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PEzJyejr; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ss23-20020a170907039700b009537f83a431si13733712ejb.1041.2023.05.16.01.55.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PEzJyejr; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3589B3896C24 for ; Tue, 16 May 2023 08:48:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3589B3896C24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684226884; bh=+eSzq0+ZndjT33wYhWhK0WJmxI+zaUGF9n6fixSCKPM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PEzJyejrTsYOs8gl5XniJAYDpFPfqmNd+6IDVTkweDo8x1INZpSk3qqd5H9r0JmZA zNCiciHEDBFmmsabUgdLzTImFmtgzb0kygQ+hmSlpMjRxSgSJV0MvyO/VZ+BDY3uE2 1wTnIPNCrGwBMN0CVyiiyjWFl2D3uUXxxUHtQ6cM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id AC1B93882012 for ; Tue, 16 May 2023 08:41:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC1B93882012 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3063afa2372so12890150f8f.0 for ; Tue, 16 May 2023 01:41:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684226487; x=1686818487; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+eSzq0+ZndjT33wYhWhK0WJmxI+zaUGF9n6fixSCKPM=; b=H3P0sOLL4Xh4oYrkXInXuBBXQwq/sPq6khevfzfPgdgAcO18FvgrpAQguYPUjL/oaz wwRbG+cwiDgFGyHN+PF5zcsrZ5JJ/314i1WIsoeb96wvhrrKdD3oTYVOn23ZR7rZqCZH oXDhkE8Y/DwcAf+JcxoKwXGFI0SQUeus0+rrRkh8TMHEM7URSgOeCBx3a28UEjRuCMqM cvnF55xmqq1l17729dn/xJT22PEhxWSoJS30Op/5cssklLSb8mIkpwYuxrfQguhpYKxr Pl79aF037fe0qCt9UR2Qa7IfeitUJxHrEKK9Hu+e8K3FeZpZRTlQAJtDsGVKmjDxnK8g hVwg== X-Gm-Message-State: AC+VfDyZYJXqmOx8PWjRVy6C0B9bu9RPwfIbFkEgB3VWVv6Dgagsmg6D XOFh0mCayLbipsqcy+fBVM26Jfw60tgZ6HAtcmQ/5g== X-Received: by 2002:adf:f5c6:0:b0:306:b3f8:690f with SMTP id k6-20020adff5c6000000b00306b3f8690fmr34112064wrp.36.1684226487424; Tue, 16 May 2023 01:41:27 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id z5-20020adfec85000000b0030795249ffasm1771034wrn.92.2023.05.16.01.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:41:26 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on chain of predicated record types Date: Tue, 16 May 2023 10:41:25 +0200 Message-Id: <20230516084125.1502265-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766040353768849351?= X-GMAIL-MSGID: =?utf-8?q?1766040353768849351?= From: Eric Botcazou The preanalysis of a predicate set on one of the record types was causing premature freezing of another record type. gcc/ada/ * sem_ch13.adb: Add with and use clauses for Expander. (Resolve_Aspect_Expressions) : Emulate a bona-fide preanalysis setup before calling Resolve_Aspect_Expression. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 1c757228241..a4a5084793e 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -38,6 +38,7 @@ with Exp_Ch3; use Exp_Ch3; with Exp_Disp; use Exp_Disp; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; +with Expander; use Expander; with Freeze; use Freeze; with Ghost; use Ghost; with Lib; use Lib; @@ -15625,15 +15626,29 @@ package body Sem_Ch13 is -- Preanalyze expression after type replacement to catch -- name resolution errors if the predicate function has -- not been built yet. + -- Note that we cannot use Preanalyze_Spec_Expression - -- because of the special handling required for - -- quantifiers, see comments on Resolve_Aspect_Expression - -- above. + -- directly because of the special handling required for + -- quantifiers (see comments on Resolve_Aspect_Expression + -- above) but we need to emulate it properly. if No (Predicate_Function (E)) then - Push_Type (E); - Resolve_Aspect_Expression (Expr); - Pop_Type (E); + declare + Save_In_Spec_Expression : constant Boolean := + In_Spec_Expression; + Save_Full_Analysis : constant Boolean := + Full_Analysis; + begin + In_Spec_Expression := True; + Full_Analysis := False; + Expander_Mode_Save_And_Set (False); + Push_Type (E); + Resolve_Aspect_Expression (Expr); + Pop_Type (E); + Expander_Mode_Restore; + Full_Analysis := Save_Full_Analysis; + In_Spec_Expression := Save_In_Spec_Expression; + end; end if; when Pre_Post_Aspects =>