From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id A0339383D837 for ; Thu, 19 May 2022 14:16:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0339383D837 Received: by mail-wr1-x435.google.com with SMTP id j25so7361253wrc.9 for ; Thu, 19 May 2022 07:16:11 -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=qmRLbPyTKbfYsEdVSkHgQ4G+hclw+0jgAjuRD+WSE7M=; b=J+5t3x+Wa+8FxDAxcDEAJeuEos33GojGFMQj16kcjREv5zsnyE3GAMsbV/9BkFeYym SA3Hbg4G70bTAPxlcsbVbtpWukBSCgReh89pUSacLMeWZ8wQjLzXOtI6bmH9F9iZO0zz BqrSrP23ssdomw1fHtgRtq1fVKLZsXasjKlS9Ri0Ge7ZUFxWOaME7fS0tzxwQfKpaJb6 61dgcJUDcSwCcpfDrIyGa3h+URiD1BWqXYFYZ9UjixsOxozl8G6D3Bum1wyU+TNGy62c DvVpNS8DRGx4AXhFCAHFE+OSCvU8QuNicNyEOfP09/Gw03ML8OYqSqZwhyO+z0zRQLmS /djQ== X-Gm-Message-State: AOAM530CC95ZeH5m8/mEo5qhNIK30ueTnWKjTujMJGJ57FgdUA8WItu7 IOE3V2y+2CcRIuifa3cLPW4rqgPHLsdbmQ== X-Google-Smtp-Source: ABdhPJyiXZvQK6ASxThNLFSJ1qbrBtKa7y1063xfy8dn6v2sq4ZQMefcNORLR8FamgUWnEvWQseLcw== X-Received: by 2002:a05:6000:1f0a:b0:20e:674a:ce2 with SMTP id bv10-20020a0560001f0a00b0020e674a0ce2mr3760271wrb.450.1652969771134; Thu, 19 May 2022 07:16:11 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id r30-20020adfb1de000000b0020c5253d90csm5072117wra.88.2022.05.19.07.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 07:16:10 -0700 (PDT) Date: Thu, 19 May 2022 14:16:09 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Ignore Predicate_Failure in GNATprove mode Message-ID: <20220519141609.GA3723309@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga" 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-List-Received-Date: Thu, 19 May 2022 14:16:13 -0000 --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In GNATprove mode we are don't want predicate failure to pollute the predicate expression extracted from the predicate function. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Build_Predicate_Function): Ignore predicate failure in GNATprove mode. --opJtzjQTFsWo+cga Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10487,7 +10487,13 @@ package body Sem_Ch13 is Second_Formal : constant Entity_Id := Next_Entity (Object_Entity); begin - if Present (PF_Expr) then + -- In GNATprove mode we are only interested in the predicate + -- expression itself and don't want a raise expression that + -- comes from the Predicate_Failure. + + if Present (PF_Expr) + and then not GNATprove_Mode + then pragma Assert (Present (Second_Formal)); -- This is an ugly hack to cope with an ugly situation. --opJtzjQTFsWo+cga--