From patchwork Sat Jan 19 15:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1027955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-494355-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qnNm7T1p"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="Upfips8n"; dkim-atps=neutral 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 43hh2z4hyYz9sBn for ; Sun, 20 Jan 2019 02:06:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=FR9gps5Cb86R4d8KtD8W79FNRkHO7Uu5r6d6pdsiJjKlU3VWXI j1tW/oEJXmAN3UGKdaTJyKKGvVJQV7YPMgv4SWA7IV2Qb0al11vdwgmMe9ROFWbI L3McYooZ7/R85adHN8wev+VWUOCdqwMb7zjO/zTGQYnwWaaF/pnPtcYLM= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=GchHS2q/CfrzvZ9llgp+5QsUs6I=; b=qnNm7T1pnxCBN0T/eZ3B EAxrKGe4qdj3rMHj4QLybRQ39T+MkMnLEIBm+AhNIQCTP0UAPYRCQfnX1J8FY89m SRqCy5dVH+mEh4qpAAgiKI/iRxLQQ2Oh156N+5eIlP0jZokp7v/HpBM2lyOp7BY4 hg/9G3LLoGiLdNw5Kwe4Iz8= Received: (qmail 125229 invoked by alias); 19 Jan 2019 15:05:53 -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 125210 invoked by uid 89); 19 Jan 2019 15:05:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:pault@g, sk:paultg, U*pault, 55 X-HELO: cc-smtpout2.netcologne.de Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 19 Jan 2019 15:05:49 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id BE21012663; Sat, 19 Jan 2019 16:05:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1547910346; bh=EVmRG9Hd5olVGF5TqVnaNisUni/GeGT1T3HSqQAA1ts=; h=To:From:Subject:Message-ID:Date:From; b=Upfips8nc8qS0JMXqKKe11BkbTYLjJU++OrsUnU9Bx8m/6NrDPKwroQEgr1l6GHbF 1rPIOXUF5ucE3llWCzwpEFebAZL/Oqs8mgGcqPhTIZqE7hu8/EiYtoNrUK2zRtjbpn sX/T5ck0PiXMBceubb5NORvOgsChu9+YZik83utEGR2GKMEnr1S4iC9/c5B5Sf1RFp JRgB6TnVx1rGko80n9D3YUaeyQt7MYxgaqBIZcNC+cs7V6Gz2dUfQbVEgj/AAnWWpc DuxDtiKX/VoMqfD/X2LWMi+xji1uEUfOAMOfIrKqg/lKdSECu0bde/VXxxwRC9AyE9 FHMOZnS1cc0CA== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id B00E011D69; Sat, 19 Jan 2019 16:05:46 +0100 (CET) Received: from [78.35.145.129] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5c433cca-0bea-7f0000012729-7f000001bcae-1 for ; Sat, 19 Jan 2019 16:05:46 +0100 Received: from [192.168.178.68] (xdsl-78-35-145-129.nc.de [78.35.145.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Sat, 19 Jan 2019 16:05:45 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix contiguous dummy arguments Message-ID: Date: Sat, 19 Jan 2019 16:05:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Hello world, the attached patch fixes handling of contiguous dummy arguments when the actual arguments are not contiguous. The patch to trans-expr.c itself was written by Paul and attached to the PR. I just added the test case. Regression-testing revealed some failing scan-tree tests due to different code being generated. I put corresponding run time tests into the new test case to make sure that no wrong code is being generated. I have also tested the new test case and the compiler with valgrind. OK for trunk? Regards Thomas 2018-01-19 Thomas Koenig Paul Thomas PR fortran/56789 * trans-expr.c (gfc_conv_procedure_call): Call gfc_conv_subref_array_arg if the formal arg is contiguous and the actual arg may not be. 2018-01-19 Thomas Koenig Paul Thomas PR fortran/56789 * gfortran.dg/contiguous_3.f90: Make code compilant. Remove scan-tree tests that fail with patch. * gfortran.dg/contiguous_8.f90: New test. Index: fortran/trans-expr.c =================================================================== --- fortran/trans-expr.c (Revision 267903) +++ fortran/trans-expr.c (Arbeitskopie) @@ -5819,6 +5819,13 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * INTENT_IN, fsym && fsym->attr.pointer); } + else if (fsym && fsym->attr.contiguous + && !gfc_is_simply_contiguous (e, false, true)) + { + gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, + fsym ? fsym->attr.intent : INTENT_INOUT, + fsym && fsym->attr.pointer); + } else gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym, sym->name, NULL); Index: testsuite/gfortran.dg/contiguous_3.f90 =================================================================== --- testsuite/gfortran.dg/contiguous_3.f90 (Revision 267903) +++ testsuite/gfortran.dg/contiguous_3.f90 (Arbeitskopie) @@ -8,6 +8,8 @@ subroutine test1(a,b) integer, pointer, contiguous :: test1_a(:) + integer, target, dimension(3) :: aa + test1_a => aa call foo(test1_a) call foo(test1_a(::1)) call foo(test1_a(::2)) @@ -56,9 +58,3 @@ contains end subroutine bar end subroutine test3 -! Once for test1 (third call), once for test3 (second call) -! { dg-final { scan-tree-dump-times "data = origptr" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_internal_pack .&parm" 2 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_internal_unpack .&parm" 2 "original" } } - -