From patchwork Tue Oct 17 07:47:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 153955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3964447vqb; Tue, 17 Oct 2023 00:48:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRLheHhyjjfrS/dnw+bjP5KDZhzSuKaUODfubFOdmZgpiGSfDBHdUd91DLha05o2KotVlz X-Received: by 2002:ad4:5e8e:0:b0:66d:9d6:633a with SMTP id jl14-20020ad45e8e000000b0066d09d6633amr2024850qvb.33.1697528890757; Tue, 17 Oct 2023 00:48:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697528890; cv=pass; d=google.com; s=arc-20160816; b=T9tkspYvuCG6YQglpY7BzDoYGreVfIlJ3wAGKacD2jg7+kMQrRslyF5KLtEVlF+jU4 Xupkc4eETRpxFfIXJRmEXyeeCbgFiOH00aWTBt9rHZqyaixKFl8pxj3W+jl6Zj184mU8 A+5TVPVaiE4WHHk0+TqZuofvcyRdtNlaEFJCR4bUwYM08aVVzgifxReewSP8c+62pQLT 7xkAHlPhsVFOhjvdBtFosxpjMAGbCPn56XsRlu+qMuUdxJQr266WUHdTTwL7tXMRBXRX o9t0IibRp6+GjKjhhA+YJ6C9EO6PZMj3EHLFKuOoS7Fraog/fIyZkcV9BRISscQo79/C dNCQ== 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:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :ironport-sdr:arc-filter:dmarc-filter:delivered-to; bh=H1IRZ1vqqAef2fRgYoTPLpF2s6GSd0Ls5ym900cHdk8=; fh=PWLXz6xnNfjusU30BP5xaGmKfq+yhGAECWirWxXhWKA=; b=SGvIoQTET+lm0aRAIEzkbF6USfU1qVjvatQTh5/qUzk88Fk/Ylh8SFv/DWnVkCFy8q 9/PKTRRjw831Hy6GKZ6BUzN8HmFcWJ6CntXQJkZEj3UNvLsRVvtuK/cyvq7t7y8XQ9IZ S5UNto/cOstmQqF+QkwwZQyxJFQFrdgFh0bVEFks3LWr8IvlRKvmJkFmmYagMXpQyQSY 4ojkl12aH5SQADUHa+vriutMNSGrIZNODu9Mrmbj9nd6c1c6Hr1y1QkMUxSB77XUnstc oWeUUBVtgBKoxLS1yNoN9x13EevajyOcQE2cFprS0ZoZJeClFgNgw8/fvU/sFsP5nfal oTCg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id eu12-20020ad44f4c000000b0066d029450afsi588491qvb.305.2023.10.17.00.48.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 00:48:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86BE03858C35 for ; Tue, 17 Oct 2023 07:48:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id E21283858D33; Tue, 17 Oct 2023 07:47:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E21283858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E21283858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697528867; cv=none; b=TgDkgKhJHdV5D8mB/JMkMUuFKmHpT8wDoxDZEzNnsgUMvZCi6ImDQ/A5yPdxXHrVAQJ0d/aDMnInR3SltKuY9O/gEm86/hfzXOH0bfQ8Hdc0yEluNPOXd7XU1Z7V3L5oJe5zZoJ16MlNnyan1HDX93mwlzmrgZ+S7h3tOi6sVw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697528867; c=relaxed/simple; bh=b6vrvjhyj+db6zMwtDhBeJ0J6ldZPcYd3EL07SsB2jw=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=KoprVNjPzif9Dyne7lvmVGjhkBNb6CCq8k29SE4lTsbRjllRfoItdpULwPXdaBXnvYODrLGX0wCkSDv+tob3yIRq2J98I6FJZI5StCefEs+hCnbTDpVG1dveZGEQ0bb6WnxyCO8Kkh0ld76iCyc0j5Y3ey78huxOsYvVzIA2ZGs= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: YIAp2zLRROuruXA0V3yRZQ== X-CSE-MsgGUID: 81wlYnfUSoOVA26nWK9B4g== X-IronPort-AV: E=Sophos;i="6.03,231,1694764800"; d="diff'?scan'208";a="22205088" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 16 Oct 2023 23:47:43 -0800 IronPort-SDR: eVt/64554W1NCsFAToYn/Z62Dof5RpmXSC3l0RbdopsIn7f8dfT57uXvp7k2Co3troxz3nccAH w8oHo+jfX3ZAiUY/dORwQcn9ZiHD95ii0wI8EMVXvSM7ttOaOSJQjP7tV6tqLdkhhjfuxFeGyT 7YZit0m/WrXGnRYGGb+joRS1M4zb4PrK3GlrAOnIwbIZr3STchp4yNqk0hHYxAjjQesHdgtaPG ZCTK0apK8yU/D4a9WbgKsNGHXJvm+vE4q9p2y5zWiuiMN+8LLmj5Nvp5Uy76+iKuQJbj15/IgK URA= Message-ID: <33a8ad77-3ef6-47e2-a6ad-6b480d21c141@codesourcery.com> Date: Tue, 17 Oct 2023 09:47:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [patch] fortran/intrinsic.texi: Improve SIGNAL intrinsic entry (was: [patch] fortran/intrinsic.texi: Add 'passed by value' to signal handler) Content-Language: en-US To: Harald Anlauf , gcc-patches , fortran References: <3f2d2471-dd94-4eb1-86b2-ae7ed439028b@gmx.de> From: Tobias Burnus In-Reply-To: <3f2d2471-dd94-4eb1-86b2-ae7ed439028b@gmx.de> X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779988053913292763 X-GMAIL-MSGID: 1779988053913292763 Hi Harald, On 16.10.23 20:31, Harald Anlauf wrote: > Hi Tobias, > > Am 16.10.23 um 19:11 schrieb Tobias Burnus: >> OK for mainline? > > I think the patch qualifies as obvious. > > While at it, you might consider removing the comment a few lines below > the place you are changing, > > @c TODO: What should the interface of the handler be? Does it take > arguments? > > and enhance the given example by e.g.: Updated version attached – I will commit it later today, unless anyone has follow-up suggestions before. Thanks for the suggestions, Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 fortran/intrinsic.texi: Improve SIGNAL intrinsic entry gcc/fortran/ChangeLog: * intrinsic.texi (signal): Mention that the argument passed to the signal handler procedure is passed by reference. Extend example. diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 6c7ad03a02c..fe446fc8a9d 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -13168,10 +13168,10 @@ end program test_sign @table @asis @item @emph{Description}: @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine -@var{HANDLER} to be executed with a single integer argument when signal -@var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to -turn off handling of signal @var{NUMBER} or revert to its default -action. See @code{signal(2)}. +@var{HANDLER} to be executed with a single integer argument passed by +value when signal @var{NUMBER} occurs. If @var{HANDLER} is an integer, +it can be used to turn off handling of signal @var{NUMBER} or revert to +its default action. See @code{signal(2)}. If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument is supplied, it is set to the value returned by @code{signal(2)}. @@ -13197,19 +13197,25 @@ Subroutine, function @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar integer. It has @code{INTENT(OUT)}. @end multitable -@c TODO: What should the interface of the handler be? Does it take arguments? @item @emph{Return value}: The @code{SIGNAL} function returns the value returned by @code{signal(2)}. @item @emph{Example}: @smallexample +module m_handler +contains + ! POSIX.1-2017: void (*func)(int) + subroutine handler_print(signum) bind(C) + use iso_c_binding, only: c_int + integer(c_int), value :: signum + print *, 'handler_print invoked with signum =', signum + end subroutine +end module program test_signal - intrinsic signal - external handler_print - - call signal (12, handler_print) - call signal (10, 1) + use m_handler + call signal (12, handler_print) ! 12 = SIGUSR3 (on some systems) + call signal (10, 1) ! 10 = SIGUSR1 and 1 = SIG_IGN (on some systems) call sleep (30) end program test_signal