From patchwork Mon May 29 08:28:53 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: 70209 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 782F53856DE2 for ; Mon, 29 May 2023 08:29:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 782F53856DE2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685348987; bh=umWQMhCkpq6zPqG2qf+6cjaYV62+oUdmLnip+524hbE=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=XpaXdVsKd0qseHt+l49qvFdCFKSVSWEXigVX12IVvjlRat7yNGwPOGLI2RLGOZM0P caLtRZ4nLwNGHzAFPHN7pX6vfDAs4ocfVwFakSPKQmWLf9GjCQ/Hkp11sixv56isqA 31Si1M7TGDaQpQjV3tqBklqVmHbZexExvGIZU1cQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 81867385700B for ; Mon, 29 May 2023 08:28:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81867385700B Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30789a4c537so1707273f8f.0 for ; Mon, 29 May 2023 01:28:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348934; x=1687940934; 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=umWQMhCkpq6zPqG2qf+6cjaYV62+oUdmLnip+524hbE=; b=H7LFlj1t8sp/N9g8uL/F92JVF3o/YyhTXtuR1p+JGBFXGzt6YVNgULCiPJjShPn1et KAtWycFsL5QIxJk6Ncl6hlNm5dZllsMnZrXAUOuDqsWlT5ASR8/yTR9qE26nGy25uEki ZVzUGyEXlyeV0ZByakUTq082JnwovwMh/ikBSqdVyVVbh4XCS6gEvisQ27oSjMj0LJmV vV7i8FmILpDNcJHmf2xlGVT6V+0OmRQAY3MjDVYHub8syGaIMdeB9jZW9CqKXupiODnY MN/fcQTaXUCg2dVOLCLx/AZy/+ysnML78yWob2Bmnrzc941w/74tpH0LLgNWGwpMyftx W/ig== X-Gm-Message-State: AC+VfDyvb2kli3Diw8ejSW2YwQifJSXgV2CTD1owKBla1G0XOuBzdrFg Q9FXj0uXwKOM287xE7FCi4lXsZvSvsZjTTNONlKGsA== X-Google-Smtp-Source: ACHHUZ6zeX11y8hWzu+zau8ri72TrPb1KotjhWnyMz5mFfpTJLBevrqyQCML28vLIgeronjr2UxExA== X-Received: by 2002:a5d:6191:0:b0:306:2b40:1258 with SMTP id j17-20020a5d6191000000b003062b401258mr8545436wru.21.1685348934375; Mon, 29 May 2023 01:28:54 -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 a2-20020a056000100200b00306415ac69asm12870839wrx.15.2023.05.29.01.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:28:53 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [COMMITTED] ada: Restore SPARK_Mode On for numerical functions Date: Mon, 29 May 2023 10:28:53 +0200 Message-Id: <20230529082853.2409094-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Yannick Moy GNATprove has ad-hoc support for the standard numerical functions, which consists in emitting an unprovable preconditions on cases which could lead to an overflow. These functions are thus valid to call from SPARK code. gcc/ada/ * libgnat/a-ngelfu.ads: Restore SPARK_Mode from context. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-ngelfu.ads | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gcc/ada/libgnat/a-ngelfu.ads b/gcc/ada/libgnat/a-ngelfu.ads index ae06ea710eb..f6d6c9643af 100644 --- a/gcc/ada/libgnat/a-ngelfu.ads +++ b/gcc/ada/libgnat/a-ngelfu.ads @@ -116,17 +116,14 @@ is Post => (if X = 0.0 then Tan'Result = 0.0); function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Tan can overflow for some values of X and Cycle Pre => Cycle > 0.0 and then abs Float_Type'Base'Remainder (X, Cycle) /= 0.25 * Cycle, Post => (if X = 0.0 then Tan'Result = 0.0); function Cot (X : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Cot can overflow for some values of X Pre => X /= 0.0; function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Cot can overflow for some values of X and Cycle Pre => Cycle > 0.0 and then X /= 0.0 and then Float_Type'Base'Remainder (X, Cycle) /= 0.0 @@ -179,11 +176,9 @@ is Post => (if X > 0.0 and then Y = 0.0 then Arccot'Result = 0.0); function Sinh (X : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Sinh can overflow for some values of X Post => (if X = 0.0 then Sinh'Result = 0.0); function Cosh (X : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Cosh can overflow for some values of X Post => Cosh'Result >= 1.0 and then (if X = 0.0 then Cosh'Result = 1.0); @@ -192,7 +187,6 @@ is and then (if X = 0.0 then Tanh'Result = 0.0); function Coth (X : Float_Type'Base) return Float_Type'Base with - SPARK_Mode => Off, -- Coth can overflow for some values of X Pre => X /= 0.0, Post => abs Coth'Result >= 1.0;