From patchwork Tue Jan 9 13:15:45 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: 186370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp100171dyi; Tue, 9 Jan 2024 05:19:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdgaUpgUDoQc8TopHbLpUwJt5kpOuiSEnQ2xH1RKmbq2AHrsKC8ZtXXzHf5Ve9FV3QKIee X-Received: by 2002:a05:6358:9043:b0:174:c6ad:7de6 with SMTP id f3-20020a056358904300b00174c6ad7de6mr3137406rwf.45.1704806366185; Tue, 09 Jan 2024 05:19:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704806366; cv=pass; d=google.com; s=arc-20160816; b=p7h+zkPa+DtATuKh7SR7eg1VkSRMgRmHV1Odtcy6XhaS2ttow7mvP7oIDrNAroy8I7 +TFLM7W4lBg9w3L/+W+FxBmURmcS0Dzq3gfP09D3tLCaDMEM/hQkUgBwG35ZM7vHeOz/ eDU7uvpNZyiRHb4gdeIiiEatLi8F0GSrgEE60V1Hc6+Gjp96xU3MR5WOOnEN1p0Jfb/v x6uG9WenihXlHvtmyMPB5qRReVLC4eDO4wvJtBc4YqxQMKeQoOr8Jih9H1jk0b6kf2yB VuAi5jG3QP2mcE7SSi+fnBqgH8jAEDca38L9QiA36CaM3+RzFW6NkE9Rft49LFoTMSD1 I13g== 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=vRKxjpYeR6WMcupBC5065MMa4vlb+gTTB56xDgloXiA=; fh=xMTG+Z2BAn45iekV7HxLGBKXrsSIb8vOWtd2ivRmbts=; b=CUXNFuru8I/ix9ZIWCcLMGSvUDg3ObMYfqXXOxkFY16cCAUkYDkBlhb3GFXXvG62Sm j8tBbyewEkNVO66puvNvyVRpa8J5HBxp0Uv41ZGBxNOGruyr0qp3boFTH6XwquXiurwE hu/+hAo67YLW8PYUFvbI4VjddUDWe7nczvXaTQAJrNA70jHQ/f4kBuZjPNAae9GtkHSz iZIWE+fBkn/OETFQJX3rIzwoPc4put2/4lviinKmYrCifypj9eERKkmqIrYtC/1CdMZt T5bv2LnEPTTAWhuDB9UyLoQSHZW30Ry5I0iFdLdmip3W4Qrwq27+FstrDDy/7SmNybPB t8dw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=O3ngLvPU; 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=QUARANTINE sp=QUARANTINE 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 g14-20020ac87f4e000000b00429a90fe161si902228qtk.352.2024.01.09.05.19.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:19:26 -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=O3ngLvPU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16A2C3864815 for ; Tue, 9 Jan 2024 13:19:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 428023861810 for ; Tue, 9 Jan 2024 13:15:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 428023861810 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 428023861810 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806151; cv=none; b=mdyVsgwhceJDStArMP6XObUrxNONOg5EMF/7VtL7Cli4g/LCjEJNEuqTy1Th936tU2aLxHPi4hRgRxt6JZdvTctlNvQ8izeJgHjj3zgKvGxAFzEP8JeiThspuZuvm3BGY9mB4aHH3V2ASssLKrkBh26BE0VtpkmYdK78lmwhrvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806151; c=relaxed/simple; bh=fFpVxcjUHIXdhJ0IUKB/pXnw5z6OJHjJNMr/tlli98s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EQtY/ZNI23IClVAYzufWLWqF8LfqE8glQI5uJWuok4H6jEZebu4w5g65rrLd631Zm5EvNqdxEN54ptBZ8eWhp2PvnchJ/r1+Xm5ocGQ7681YSYQ8T1q1BfhR0YPcqcy98unRudld+/vJfv7GTyHsvon7S2scFrbuACcIOJf+OJM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33677fb38a3so3046388f8f.0 for ; Tue, 09 Jan 2024 05:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704806147; x=1705410947; 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=vRKxjpYeR6WMcupBC5065MMa4vlb+gTTB56xDgloXiA=; b=O3ngLvPU9KhTMD+OyFFT9qlCGih2cbi8g70dg7Izp7JFCYlS/Jso/k8sKLz7Ps36qG K1zAE5Fgwm+6Gu0MAelWSSJSCjmenWM36Z9++W6R0edeRZaecQjTrGTuLI915gTtChii ryaLZ5n8dHiaX/U6Ikd+NBvt7cnL9jiuQVEWQgZyGF3+DxrpKZVUxqtK6JSWojvRfShr Fg5YTiHb8ULLLryPe2w+6Miyc7qgOW0qPzPhKIm0L6GNGSmbnd0zpWdtRVlkT+tODrS1 2Q8L7qaKDWLF5a0W0xuJ2KxSDrbgclf8RwwAezPQfuBVd4Z0VNSOPbjj1MDEOxGWT7kB w/Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806147; x=1705410947; 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=vRKxjpYeR6WMcupBC5065MMa4vlb+gTTB56xDgloXiA=; b=fDeIReS7tC/gWapevgKY3F48c9K1Rk/F/0OEWz8kpy2h3QgH7Rba6ZDdNgIImIN0Kn TYOKgcSx2xJbVJRNNZKVzzQNCwBiOB5jbeNBgB93+wt9RKcAA/+F+lyCzS60SXu5bA1k kKuTWqqKHiAB/Tdhtn1s7EnnnsHnvaT1D6d7E9lkA2TlSzTyV7tjq30ztUhuW81O//28 TOpVowKtgxBteHgkHzpjOKQpsZZShtOBB3UUvdFJPowl/uKXNRkgehPi9JBu/YH3Ml3W 7RTct56m9OSk37ZE7b562F2aO+V9MTaaa9PaSMRKdnpQth8kX032UVr6ilWwWKJs8bKS 0OKA== X-Gm-Message-State: AOJu0YwjjoHgySr+XS3gZrljhIWfY6WQA657O6lBLsXwqKPwvOInhs4I JaaZqY8xJmvFvEEahOMIatY9RIUyWf036sGH2crfySQErg== X-Received: by 2002:a5d:598f:0:b0:337:5c01:5554 with SMTP id n15-20020a5d598f000000b003375c015554mr585438wri.9.1704806147118; Tue, 09 Jan 2024 05:15:47 -0800 (PST) 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 dp13-20020a0560000c8d00b0033761b2de64sm2406638wrb.76.2024.01.09.05.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:15:46 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED] ada: Cannot requeue to a procedure implemented by an entry Date: Tue, 9 Jan 2024 14:15:45 +0100 Message-ID: <20240109131545.744441-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.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.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: 1787619040002181414 X-GMAIL-MSGID: 1787619040002181414 From: Javier Miranda Add missing support for RM 9.5.4(5.6/4): the target of a requeue statement may be a procedure when its name denotes a renaming of an entry. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Specification): Do not replace the type of the formals with its corresponding record in init-procs. * sem_ch9.adb (Analyze_Requeue): Add missing support to requeue to a procedure that denotes a renaming of an entry. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch6.adb | 1 + gcc/ada/sem_ch9.adb | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index bdfe446d014..8a7dfef9019 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -5373,6 +5373,7 @@ package body Sem_Ch6 is if Ada_Version >= Ada_2005 and then not Is_Invariant_Procedure_Or_Body (Designator) + and then not Is_Init_Proc (Designator) then declare Formal : Entity_Id; diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index 365887cbe14..8e6ba4c6b81 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -2438,6 +2438,32 @@ package body Sem_Ch9 is Entry_Name := Selector_Name (Entry_Name); end if; + -- Ada 2012 (9.5.4(5.6/4): "If the target is a procedure, the name + -- shall denote a renaming of an entry or ...". We support this + -- language rule replacing the target procedure with the renamed + -- entry. Thus, reanalyzing the resulting requeue statement we + -- reuse all the Ada 2005 machinery to perform the analysis. + + if Nkind (Entry_Name) in N_Has_Entity then + declare + Target_E : constant Entity_Id := Entity (Entry_Name); + + begin + if Ada_Version >= Ada_2012 + and then Ekind (Target_E) = E_Procedure + and then Convention (Target_E) = Convention_Entry + and then Nkind (Original_Node (Parent (Parent (Target_E)))) + = N_Subprogram_Renaming_Declaration + then + Set_Name (N, + New_Copy_Tree + (Name (Original_Node (Parent (Parent (Target_E)))))); + Analyze_Requeue (N); + return; + end if; + end; + end if; + -- If an explicit target object is given then we have to check the -- restrictions of 9.5.4(6).