From patchwork Thu Sep 22 15:09:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 673458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sg0L36z8Cz9t1C for ; Fri, 23 Sep 2016 01:10:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=R0KJ4GOk; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=RLegkpAvVlD6+2naGwnTD8/jXi1NWTVL4s6jwTpSyUJGYU5cRYwFD TdzATqdrXYENP9vuc2/7VFDoGs5fAOkL+RpuqcR2DEQWHefqrgIJRhrC8YFn5byX Vup5h8lMaKvBunw89t2ajnrkvEdMsLue/Ree1BNXJ4MBNeHUlnTv6E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=7g/ejYAJpJu4hkuu2JfVWa3ghEA=; b=R0KJ4GOkPUMAI42TyusC avCy5TeQrvR+wrUgoS37wTifAbohRImXkZEC8acl3UGMcQh/Q7Kbdyit3HFv4Z9t fLbLcfY/OEBPwGKNeY3CDCh7VzXVTwOocHdmNzNIoSlSLbAYaovNYaEmpA7BTIJ8 ATRnzJmVZcohHvchMSmphW0= Received: (qmail 5960 invoked by alias); 22 Sep 2016 15:10:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 4208 invoked by uid 89); 22 Sep 2016 15:10:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*damian, U*vehre, Vehreschild, vehreschild X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Sep 2016 15:10:09 +0000 Received: from vepi2 ([84.63.206.51]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MeMOx-1bcHqy0k6p-00QF2i; Thu, 22 Sep 2016 17:09:59 +0200 Date: Thu, 22 Sep 2016 17:09:57 +0200 From: Andre Vehreschild To: GCC-Patches-ML , GCC-Fortran-ML , Paul Richard Thomas , Damian Rouson Subject: [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly) Message-ID: <20160922170957.3d711752@vepi2> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; V01:K0:DhfEX37dIVk=:8gB5VPeaK2xzSLd5etwztA qQuXdtidsYVdlQwTi2DrMzk1FGI94pJsalBuyYyXmwPr+AAOaG9dU+zgB168YKGv5usUR7c80 c6s1PqQ1VLRP0dZufwH+fvd/cNtQ1MuzBp8UEuNGqNoqxGp2uETrZx3WFtOFGV4tjjAMorYAg 2Ps91lRDsgV9sRHq+epsEkSpkCAWns2KTLZpwdR4iwzXxkEl7OimVNUMMOYkloRij3xCzjjR7 PKhC+oREVQ/WaD53UuHHBJRovVmrppCMhep3pSYKBqiOJc7C+tPK693B5bP5YvfBR02t0b35G 33EhaXBqkGmU5vPv8gWGa9RKr+YEvabjqaiq+W4PX8AoF+4ZrWPSdksMYtUQ28h4bCZPFZtJu T8fL/oy7jHTqFhfh6AgdIxGLSDM+sqWI9FoeLY3lAMO/obaXUaheduSxK7NQe0rCJ8TUBY82Z 1iNx8HZU6X7c5+y2yjULA7MMibIYF64j0ekhnB4+EoWn4Xuxt2OZ4jeSaSUYVncTnuaGHqhe1 7DujUcpMVCeRmubmjWBvrpDqx/TlOffsOaInbo/5irXzQZ+H1GQ4npdVCEVqaVWO4x33oDDNs fsO4irKLVCxUmjklidqUfC2F84z+ObZGG5LxxrWwMg85GeS6rK1kZhR8i8TNZVJr91rLVfHHu c5fvz4NdUtAeG8ndY1gIlZHgvVizUqYks31dDgFpIOxA804tOy7muAasTO9Qr4mo3KNuj2M8d 0Otrck8tudc9Jbr+t2Aq0vhNukI3fMQKU2G5mqBQ2NN9NvHjyT+LAmSWgQE= Hi all, attached patch fixes compatibility with opencoarrays by using the old coarray interface of caf_get() as long as possible. Bootstrapped and regtested ok on x86_64-linux/F23. Ok for trunk? Regards, Andre diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index c6883dc..d3f6842 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1607,10 +1607,9 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, else stat = null_pointer_node; - /* Always use the new get_by_ref (). When no allocatable components are - present and the lhs does not reallocation then the "old" get () might - suffice. */ - if (true) //caf_attr->alloc_comp && !may_realloc) + /* Only use the new get_by_ref () where it is necessary. I.e., when the lhs + is reallocatable or the right-hand side has allocatable components. */ + if (caf_attr->alloc_comp || may_realloc) { /* Get using caf_get_by_ref. */ caf_reference = conv_expr_ref_to_caf_ref (&se->pre, array_expr); diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 index 7ab5ab4..cfd1e64 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 @@ -40,7 +40,7 @@ end ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.0, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 1, 0, 0B\\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.1, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 0, 0, 0B\\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }