From patchwork Tue May 7 08:00:04 2024 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: 1932272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=KME3zw03; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYW4762G8z1ymg for ; Tue, 7 May 2024 18:03:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15D833849AF1 for ; Tue, 7 May 2024 08:03:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 6B30B385F014 for ; Tue, 7 May 2024 08:00:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B30B385F014 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B30B385F014 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715068821; cv=none; b=ImVDOGwnwyAXWOo4Bf9xRLlaKPAA2gHutDv8NSqAUZ3wwn532+lvbie+mxhscjXVlXAMKySwCYGPM+1R1oRfzrusKcRXAbd6pHZOIMpbW/MCZXeO+GEH3+uzxdlOYqIT8JfqsNnrnHNBpcRhve2eUcBJJXYXXgP33gOQs8AsiwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715068821; c=relaxed/simple; bh=K/6e5tMfYZ7W+K7u4Ee1Hi3AjTvViBh0lmQjKm9VeTw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nLCQ6+BsxMffTD0XTRsHWFNnIWmA2YOsQSZLexE+FFa2/izvybNw1Qprh3J+rTuDU8Q9JWJf12zf6q1Z+lp5tusUTLEOt16rHCY4dEw4fbLbG0AWRxFvsHs5sjbFXuOTqa/sZS5gVyv1zmM3WCNc+XW9e2+nxNDhQr0QiJhSU4I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-34db9a38755so2624704f8f.1 for ; Tue, 07 May 2024 01:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715068807; x=1715673607; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DRsJJdWyesZzpgOwRjpEdwYMO91XTph9xHUt97P/DpQ=; b=KME3zw03ccHVMULLKPwCkTharM0QoEK80Cgx0tqSCAV95XJDjxd3hmbuisjFcuZ5Dc fz+CRovExKCXhIdRtVpynnK9f2XQozLhqqJTViDDnCvCQSoTTGLjzUNu/gP25XPcdJmw EH67pXT3dvFgVwb0OKCq605KGdZHa53RczbTTeFsrdnZBPSrbV5hf3yfbiDNVuHpgUw7 sH5WADF4UHDVxmYsIAJp3guTCXK1N2AH0Mz2HjeUKKziq9jUo++x2TlhT/0kC6tPJfZl nRv3HlsudsgOpR5X6axgcSl45g4OCaCW0SosXaZBVXObwsfm6Q4AbcIsTxMfpO9JHP7h /3QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715068807; x=1715673607; 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=DRsJJdWyesZzpgOwRjpEdwYMO91XTph9xHUt97P/DpQ=; b=SiLuEhcNwQXymPWVbddggwpcw4NVZ1Ba6cH2qyczYfS1cMphyB28wI4qXpGjib4Ecb JiQ4t36Kra+Up6MJY1YT9n++eRnEU5F/KSwbrMJOK4o+wj6Zgf7/8t6MWxxgfqEv5GFW QYOr1uutHt7Cx7X2TUZkbItrLh1oujBn/J4rIMucf0ZTmB/LrWy6KtIAbyyf4eQcvR0M Tji9L60KXFu3aS9STqvul8qPk3CkS86vhb9uJYh3m44JZJq0hZVQK4aIBny+8XjX0rTu UiAEJtA+HmCJz7I7mHyomKs6fsNXVQ1NJfBp5MtojkzvwOwYH+1/eatO34Y4sQk3Qvis lf9w== X-Gm-Message-State: AOJu0YzN8S8MDTFGt4nfKpd24t75/mNuAYYePAM2kNiAdSucAKC3O8gH 9t4pzraDwlrevECCc5HaP4k9QEDNndJVZygRsz36GlvzqDbrkZ9Zfdc4ZiLDIUOivHYf6TXLnVg = X-Google-Smtp-Source: AGHT+IFVDYjy2DtaSjR0JeK6v1Fmw/5d/bRNslSS5ll0TmGaBui1KNPYk73Db+kLXlmi9Uk8ZBlhgQ== X-Received: by 2002:a5d:6449:0:b0:34d:e252:b57a with SMTP id d9-20020a5d6449000000b0034de252b57amr10761906wrw.52.1715068807156; Tue, 07 May 2024 01:00:07 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:11a6:1c9d:5099:b1e8]) by smtp.gmail.com with ESMTPSA id n12-20020a05600c3b8c00b0041bf87e702asm18826554wms.10.2024.05.07.01.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 01:00:06 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [COMMITTED] ada: Fix missing flag for GNATprove Date: Tue, 7 May 2024 10:00:04 +0200 Message-ID: <20240507080004.36893-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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.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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Yannick Moy GNATprove expects the frontend to position correctly range check flags, on expressions which might lead to a range check failure. This was missing on in-out parameters of calls. Now fixed. There is no impact on compilation. gcc/ada/ * sem_res.adb (Resolve_Actuals): Add range check flag. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_res.adb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 67062c6b32b..dc48b0b7638 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4388,6 +4388,17 @@ package body Sem_Res is Resolve (Expression (A)); end if; + -- In GNATprove mode, add a range check flag on scalar + -- conversions for IN OUT parameters. The check may be + -- needed on entry from the call. + + if GNATprove_Mode + and then Ekind (F) = E_In_Out_Parameter + and then Is_Scalar_Type (Etype (F)) + then + Set_Do_Range_Check (Expression (A)); + end if; + -- If the actual is a function call that returns a limited -- unconstrained object that needs finalization, create a -- transient scope for it, so that it can receive the proper