From patchwork Tue May 16 08:40:58 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: 94533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp274067vqo; Tue, 16 May 2023 01:51:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4NIb0AdOc1E/93j+ICJa8+F1EqNI20+LmLseQI7r3utrwHl/Fw9oGQHDJds5gQ0JKNEdiL X-Received: by 2002:a17:907:7251:b0:96a:1ee9:4b0 with SMTP id ds17-20020a170907725100b0096a1ee904b0mr18051590ejc.33.1684227106795; Tue, 16 May 2023 01:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684227106; cv=none; d=google.com; s=arc-20160816; b=gG5uORJed+Dl5zTtEeh2/aUWpfo3TTU31TXW09NBI2rjsKMtrkyzSIjYtuLoTUEme0 5GpxjUP43qzyKS15B4uvLxgKnU+VyEIxjZJUxB4jbCNih+y20F69EpwNSjraB6pLiXXT HFZfDOLhss0zTm/hGZ30in67V1WjHUcTynvOxPnF3/c4ptbQCfTxHNA7CTvoLNcHzxrx 1ktNz5YLFKV7qK1ZbGms9xpAD921CHpLd3NMDxc8iHA66wJ/qVbfcV3H6HGZNR6b7Gjn 2YtUxPXNRMP9sfQKGJY3UwCZk5KThyhFiqi/r7eC2mV/pGVd3OyeOTL7UFl1cRybOC7H rN2Q== 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=jI3Ov4SwBaadV8mHkhL8cxI+IEy8ApP/uKvleTUScRM=; b=N0x0HGNUb8ljFZVskMs7ZgyTE786gIZZ8fEYfWvG2xeWscOaF0MeV79hIFebwc10M4 tUyxTxzHi3xd9Zk6CJg9o/kZDnFqP6J3HuF28HUNBU/rCalEVQ8eCy8JVpMwNeXM4eTl Zxw7ZpXfKCmKV2r1D/wNWoIjBbK7BM/9lp9tD4oJtWOPsx5Y+Gnw09gluii9rRG1yYFi b/+x8+bYSWKW/7OaRy2JNtAxdn1F+J47dYbQ23/BoDvHXEk5OKZYeQ6pXJ1w572tL0aX NE05FLOxbn9fdC4i1ilIYO8yhRqd4qX5rslPLl+Y6l3ES1QHLS3FiQygeN+AQhrW1Hkq FJVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ZcSInQeG; 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 hq24-20020a1709073f1800b0096a91ab434bsi10054528ejc.493.2023.05.16.01.51.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:51:46 -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=ZcSInQeG; 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 42B3438555BE for ; Tue, 16 May 2023 08:45:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42B3438555BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684226744; bh=jI3Ov4SwBaadV8mHkhL8cxI+IEy8ApP/uKvleTUScRM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ZcSInQeGgG9H1Cc3iBxxRAqBKgwSIla6Y1qOR5Vy/eCsJXzfI7THHHaed55my5X6g xVnUjz8fwRrqFA4kr7LYpkXhYPBbzsx/kiSjgJ4qYbhBdHDz2Zp1RikLibJ9ysqpBp ttE/dBkoVqtGA9sDaVHbLSFUq5rNxWMGHiRvmhjc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id BC3693854142 for ; Tue, 16 May 2023 08:41:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC3693854142 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f509ec3196so16210095e9.1 for ; Tue, 16 May 2023 01:41:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684226460; x=1686818460; 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=jI3Ov4SwBaadV8mHkhL8cxI+IEy8ApP/uKvleTUScRM=; b=NORGIQfWUoov6osaOq+CedXuuUtoiAOnqqteVYSd6n+Pep/BXUEMR7IFXW0CEiw4pX vuS2/MOo4qn0D+5tyyCff/SKK57t5eazAscbaBYx7pcKoWXHCA7NVFbFlM+Gi4ku0qiG Q14Bi09CLabEnAve8UuJxArztY68V3f5/vFwNK8uRvYT2olyKPujJBm3w1P+ot5pTFlf E8gmLGQ8eyVoRcEhoDU+IHsFG0an7JYgrZEZm02xJaZ2vOC1V/TPV1q3K3fjpwQ8A9HM bBgOgu733VDZWwFoWnI5eTSysGa6erJLCuUBx6N4iGqZzU8DOkiPaMv6xj6kZug38wfT 76hA== X-Gm-Message-State: AC+VfDzTWS1d9AuBmLWuHItZQAsF1XvXYJ3xcUrnZUHfUnwkJrcw0bfe idwIvI0haOmr8u05K/P/bTb9RgZatg56rFU8OW1M0A== X-Received: by 2002:adf:ff8c:0:b0:2f8:33bd:a170 with SMTP id j12-20020adfff8c000000b002f833bda170mr30949220wrr.32.1684226460353; Tue, 16 May 2023 01:41:00 -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 q14-20020adfdfce000000b00304ae802f02sm1773886wrn.66.2023.05.16.01.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:40:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Apply range checks to preanalyzed aggregate expressions Date: Tue, 16 May 2023 10:40:58 +0200 Message-Id: <20230516084058.1501934-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?1766040122245176178?= X-GMAIL-MSGID: =?utf-8?q?1766040122245176178?= From: Piotr Trojanek When preanalyzing expressions in GNATprove mode, e.g. Pre/Post contracts, we apply checks, because these expressions will never be expanded. This didn't happen for aggregate expressions, most likely because of an oversight. gcc/ada/ * sem_util.adb (Aggregate_Constraint_Checks): Don't exit early when preanalysing in GNATprove mode. Now the condition is consistent with other similar conditions in other code. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ad74de6b6f6..38dc654f7be 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -477,7 +477,7 @@ package body Sem_Util is -- this breaks the name resolution mechanism for generic instances. if not Expander_Active - and (Inside_A_Generic or not Full_Analysis or not GNATprove_Mode) + and not (GNATprove_Mode and not Inside_A_Generic) then return; end if;