From patchwork Tue Jul 11 10:32:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 11858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp378304vqm; Tue, 11 Jul 2023 03:34:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEkx70D+207s7eNH7fjySw6qfwQ2eIyI68B9lmlycIKtxI/3m6qPU0JJPpSX9SQoZNzNBeJ X-Received: by 2002:aa7:da98:0:b0:51e:1c18:dd99 with SMTP id q24-20020aa7da98000000b0051e1c18dd99mr12885282eds.38.1689071653559; Tue, 11 Jul 2023 03:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689071653; cv=none; d=google.com; s=arc-20160816; b=vRXmWi4GgWcyqDbwSO7dPeYpoKI0y+jZXtL0oGHTBwukob+ktIKFZ1Ac4ETjfLYXxB cEC3pOUlnO/HesaqkggZ9GpFc5rxc8CLegkJu0TFBqdK7RbU9AEfoPJZIYoHiP71T9DM OLMtj5+OlomRTQRzK4ZjhXM1Jrkie63M02Z5LIDrNkB2SyqXhPh4Kg6Sg2WvcAiNzzs3 EZkgn5TcIR2JIH2PPhjaXCu6fEZOVqn+CdztmAefa5czLNstySmLKhccgTgEic6VTUNj i4Yi7ckSpNMX3jjSa5Pij3XOg3S7Al2AAPRpIM7VSP/U08XxQg3Dk/qh+BV19APhPmyM xIdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=OhyX3KNS5lvI0Ag1BA5ddCd863CRfUGBEzZWUDAIP7g=; fh=EAqAZnhg4AYtcBjfPm18lEF5V0R2rkI9MSWQf+svVaI=; b=DKXuWz8Tc6gOfJwJXb/92YqJnkWLMwDgd5bT2VqvT0B9bggcDr8VmEDb8qgtjhxTWE Cd4T6ITpTs4C1HWj11ZGitK9/jvaezkyJt6CdIeaOPvFwRWMkjfeZ5Gxd0gRSu9znwIf 8OQiX+z2cjpX/+HQb1EsBefBP05TO2x/8FD4QDEVt8vDI9i0CZDFB9pc3nDoz4LJiGXb l2eeBKJVP+jHMpEqKfq/8L5poDs1tkgKnk7Kk8x984s6NPrPG7E5Nq8RcGybwp+xFOGn URp6wcGHscrzF/3tF0lHqztxPu0/ZVyKxEw7RVGyPFsu29XI0NfoQpnMpAk7OLa7ofgr 9faA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HsImgd60; 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=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r6-20020aa7cfc6000000b0051dfa08070fsi1674068edy.430.2023.07.11.03.34.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 03:34:13 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=HsImgd60; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56D7D385AF8F for ; Tue, 11 Jul 2023 10:33:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56D7D385AF8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689071630; bh=OhyX3KNS5lvI0Ag1BA5ddCd863CRfUGBEzZWUDAIP7g=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=HsImgd60F6AEiigq1E90/Hi++c3ILdpf2MUP9erdhxU8n2L/99wNT3MQPJe6T81ys KSawKSwQlE5XumPI2DI97cy6O+t3A8rg9djnQKHcjNaE4KK+3rXx0Xg056FHFyPU9a VpS2Zj7YcirXkZOl7r0IqIOhc/5mLcBjBht//x7I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by sourceware.org (Postfix) with ESMTPS id A6628385840E for ; Tue, 11 Jul 2023 10:33:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6628385840E Received: from cyrano.home ([86.215.161.51]) by smtp.orange.fr with ESMTPA id JAfuqCdJWn02aJAg1qNA3v; Tue, 11 Jul 2023 12:33:02 +0200 X-ME-Helo: cyrano.home X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Tue, 11 Jul 2023 12:33:02 +0200 X-ME-IP: 86.215.161.51 To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 0/3] Fix argument evaluation order [PR92178] Date: Tue, 11 Jul 2023 12:32:50 +0200 Message-Id: <20230711103253.1589353-1-mikael@gcc.gnu.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: Mikael Morin via Gcc-patches From: Mikael Morin Reply-To: Mikael Morin Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771119998307230954 X-GMAIL-MSGID: 1771119998307230954 Hello, this is a followup to Harald's recent work [1] on the evaluation order of arguments, when one of them is passed to an intent(out) allocatable dummy and is deallocated before the call. This extends Harald's fix to support: - scalars passed to assumed rank dummies (patch 1), - scalars passed to assumed rank dummies with the data reference depending on its own content (patch 2), - arrays with the data reference depending on its own content (patch 3). There is one (last?) case which is not supported, for which I have opened a separate PR [2]. Regression tested on x86_64-pc-linux-gnu. OK for master? [1] https://gcc.gnu.org/pipermail/fortran/2023-July/059562.html [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110618 Mikael Morin (3): fortran: defer class wrapper initialization after deallocation [PR92178] fortran: Factor data references for scalar class argument wrapping [PR92178] fortran: Reorder array argument evaluation parts [PR92178] gcc/fortran/trans-array.cc | 3 + gcc/fortran/trans-expr.cc | 130 +++++++++++++++++--- gcc/fortran/trans.cc | 28 +++++ gcc/fortran/trans.h | 8 +- gcc/testsuite/gfortran.dg/intent_out_19.f90 | 22 ++++ gcc/testsuite/gfortran.dg/intent_out_20.f90 | 33 +++++ gcc/testsuite/gfortran.dg/intent_out_21.f90 | 33 +++++ 7 files changed, 236 insertions(+), 21 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/intent_out_19.f90 create mode 100644 gcc/testsuite/gfortran.dg/intent_out_20.f90 create mode 100644 gcc/testsuite/gfortran.dg/intent_out_21.f90