From patchwork Tue Dec 19 14:30:50 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: 181003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1979864dyi; Tue, 19 Dec 2023 06:34:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/1rUG8ELt7z7vXc2yqsoGT/m12s2sKejdd/TbXtzlcR8Cuw8+yZv80p1TRekdYqsbXNpd X-Received: by 2002:a05:6102:3c98:b0:464:9457:a9e with SMTP id c24-20020a0561023c9800b0046494570a9emr874231vsv.20.1702996473638; Tue, 19 Dec 2023 06:34:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702996473; cv=pass; d=google.com; s=arc-20160816; b=q6A0FMsWhMb/5TaqAoiVuHgclZZDZ4w9rg0PbB2UweH1Lz6DXZ4P0C2QvQqbwtHGzh F8AgW9/Sc3I1fBDsJ34bImiyg+lNcyChOylmBDyBlOvwyQc2DcxwQh1QjHdwzIg0HrKR Zs6HSHDUHpP5cDyTcKYrLkb4uvn/3KWvVe1wP5ED1SF9tYhvw+pOD6Ge3HDiSlW9VOr7 7Q18YPR2bl0BEOibHfvHXSXdhYpwUlAeR/5WnEglUWRTBgW4+/8TYyG/qUC38Jpyreda /VTD0PFF+IGH8Bku8tyPIFzlc+KFeJeJyj68JEYU5v5f+ZdG8vYnmrvsxqnYXx9H+ZPo dJog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=eFfQWpev1uUHB8zMbPvGFvdwLE95g8AMEQrLzsY54Js=; fh=QRb7QY4BZ0mIIAPiH2G4K0PcYKRtRn2i5A6VLUA8cN4=; b=AQJ9ioRmPHJOU/9JZ5LCUJSMwT6cpV2im5PaWP+0jxgeK3NGuMQ+UboupGfOzS6CSf RDoXXz2Whxer8+YRTom4uKM/LdpHEhAtBsFKcLclagdpiy2FcAf5Wi0cKqUFLj+zbf8I fCs2nohileW7H4U3utycrkNDhCabXg/0dCDK0a2dkMPG5+YvuMe/O9N92yiw5nLEvlUT qyeppRo6IKlzhSmdmRsr86GWfWYWL2gDCj0s70XnfzY2OFxqt8gT84HgDxNd4nLJnca5 +GN6XRIgYZVk0/TKHPD3lr+x0bXVJxOAbEq/rQqCXrDax6xuhP1j0RN2lnwPqZ/BkrUe KSkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=hwMNzzSN; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i7-20020a67e2c7000000b0046681a797b2si884351vsm.523.2023.12.19.06.34.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:34:33 -0800 (PST) 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=@adacore.com header.s=google header.b=hwMNzzSN; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 33F50387084D for ; Tue, 19 Dec 2023 14:32:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id AFD43385E453 for ; Tue, 19 Dec 2023 14:30:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFD43385E453 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 AFD43385E453 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702996255; cv=none; b=c/xTGG+0OP/KrhUcsYpY6sJNH17Te2eghQcGb5FZcV6Gr9GJNrXLVJJlJQw6L+tPziH2Dt8DMq70dBzg8EDURHUOn0YfyLxLZ4g8NjvLvf2QHmNobnvJ3d+1Zffkk0bBBJmc2gGJHEUZi2GIpqIFAiTPOXWu5ev2bzULwFBKMWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702996255; c=relaxed/simple; bh=TrDvUNsOZ3iXHpsxb/cgaRJos1vPnZ+a7mER8BlF7Io=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vpwIeJ41JhrSzCObM/HePzUKA9C1b3ccbHS6jSMaRPicTqmwgBrB93LV/e0IrQ3lexcO52s80le8a9nDAbDu+4+iA2/HIvT4CMYOJ2EjFLyDPSKpge0nZzdlnkHWFSNaHpAT29Riw8+f/tIKRByMifgIiRISna90XW+YdQ+wXoc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cc55698c81so49821351fa.0 for ; Tue, 19 Dec 2023 06:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702996252; x=1703601052; 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=eFfQWpev1uUHB8zMbPvGFvdwLE95g8AMEQrLzsY54Js=; b=hwMNzzSNaB96ytGktFPmvjK6c8uozM1r1AiJfOJQznzjyijOl7ZEHVBza++DxeWSNL SPwSA7J26+JPVUbiFkvlScVy01T+Kls8lcnbQJgkUDlAUMFJERY1lvcdnj5XiA4WHjRf ZZnHF+dAw+Z8yueVwPUsLI1zqOCTwtxoxJ5mHWqlTcbpY2/uitBCA3n7bkaejISlIXwS PtXJaNAbymA3o0UokMEkksk2U0KS0bZubOyycHcs+BMn+1xi8VTHxStIKSiHJhFMpvZq HIs1BIg8hcasaP00aMWBKVC6V+SlhDIHr4cGiSvG9HZOD1D747WhAmla71Hvp27N9LGm a3Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702996252; x=1703601052; 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=eFfQWpev1uUHB8zMbPvGFvdwLE95g8AMEQrLzsY54Js=; b=lA2W25J7HPFgvAU7WYvUIsR8FId5SOTjuR/iTUYad9QXwzUSXrIMIfgQYuCcrkVcmt rcXwh4OGES0QU5Zfy4rjKE1BuYvJx6Nk62N8/WOaYWDAaBtmow9It6bVk+vzXEDXg2gR gv3sYzNUBXhanj+Uv10ejzNCqqS5SDcTK7QPIkBCRPeaY2Q1I0M06d6T0xcZAnYrhajl aDSoscSR7DRTrB/84N/L7CySpK3MxBp2lLZ6TvlBju/q65FnetSw0oqz+fuipzo2AYCQ 2PtEBDufMnRpVqLGypubzfP9vANoGMrgyBw6LkWVylyii/F332m+u0rzc4ge0HJJ8G5l VV+A== X-Gm-Message-State: AOJu0Yy789kjG2zH1jKmWmzU8cKRWaBl09i9cMtjLb9OwE+yYlRFVH9y 62SEw8+kPjH1MlBdQv6aASJFGZQTKcNHwCq5moU= X-Received: by 2002:a2e:9c8e:0:b0:2cc:5cf4:c394 with SMTP id x14-20020a2e9c8e000000b002cc5cf4c394mr3192977lji.15.1702996252182; Tue, 19 Dec 2023 06:30:52 -0800 (PST) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:fe1e:443:c34f:edaa]) by smtp.gmail.com with ESMTPSA id v30-20020adfa1de000000b003366cb73f74sm4125291wrv.66.2023.12.19.06.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:30:51 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Ignore unconstrained components as inputs for Depends Date: Tue, 19 Dec 2023 15:30:50 +0100 Message-ID: <20231219143050.455490-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 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, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785721230202088932 X-GMAIL-MSGID: 1785721230202088932 From: Piotr Trojanek The current wording of SPARK RM 6.1.5(5) about the inputs for the Depends contract doesn't mention "a record with at least one unconstrained component". gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Update comment and body. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index db20f20b9f1..a2e705110de 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -283,8 +283,7 @@ package body Sem_Prag is function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean; -- Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of -- pragma Depends. Determine whether the type of dependency item Item is - -- tagged, unconstrained array, unconstrained record or a record with at - -- least one unconstrained component. + -- tagged, unconstrained array or unconstrained record. procedure Record_Possible_Body_Reference (State_Id : Entity_Id; @@ -32957,36 +32956,7 @@ package body Sem_Prag is function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean is - function Has_Unconstrained_Component (Typ : Entity_Id) return Boolean; - -- Determine whether record type Typ has at least one unconstrained - -- component. - - --------------------------------- - -- Has_Unconstrained_Component -- - --------------------------------- - - function Has_Unconstrained_Component (Typ : Entity_Id) return Boolean is - Comp : Entity_Id; - - begin - Comp := First_Component (Typ); - while Present (Comp) loop - if Is_Unconstrained_Or_Tagged_Item (Comp) then - return True; - end if; - - Next_Component (Comp); - end loop; - - return False; - end Has_Unconstrained_Component; - - -- Local variables - Typ : constant Entity_Id := Etype (Item); - - -- Start of processing for Is_Unconstrained_Or_Tagged_Item - begin if Is_Tagged_Type (Typ) then return True; @@ -32995,11 +32965,7 @@ package body Sem_Prag is return True; elsif Is_Record_Type (Typ) then - if Has_Discriminants (Typ) and then not Is_Constrained (Typ) then - return True; - else - return Has_Unconstrained_Component (Typ); - end if; + return Has_Discriminants (Typ) and then not Is_Constrained (Typ); elsif Is_Private_Type (Typ) and then Has_Discriminants (Typ) then return True;