From patchwork Mon Feb 18 22:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1044349 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-496584-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="nKYVPYvf"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="NJHGOtiR"; 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 443Hv54J0Hz9s3l for ; Tue, 19 Feb 2019 09:03:44 +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=vaH+GR6lC9YX9nG/VopA94c4aH+PzzoxVYwtFQXQIw9XwJOW1H +8I245/XxD/5njl5mivuFJbB9w/KEqXQ47gDJAkv5zHLscblHMvXEftpxmqLc41f JYBYzfRJZBMtGwOkODUJdZ8Tgh36cZlHK1c3W2d1ilYfB2/arbx05tIs8= 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=2NiqveHnA5+ToP0DdKwflKNre6A=; b=nKYVPYvf+najq1qFIQKA XS+mnDokjcGOHbW+wQyf76SKxU+SsJ0ttgxkO1W7vVSxi0bjS7G9TmhQPCtPX/Mm k09KKMV6pAiXJ8V+uD8It7jY65emIEuHYNYPWRabjw6TKvx1SoZ+eqsHEJoD8bMZ AxESFKBhQ/X8UR7d9Vm4lKc= Received: (qmail 42540 invoked by alias); 18 Feb 2019 22:03:32 -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 42516 invoked by uid 89); 18 Feb 2019 22:03:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: cc-smtpout3.netcologne.de Received: from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Feb 2019 22:03:30 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id C43A11255D; Mon, 18 Feb 2019 23:03:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1550527406; bh=70dq/pSjp/nVxGzXxPndNwijssRzEHkFVKkkGDSJZms=; h=To:From:Subject:Message-ID:Date:From; b=NJHGOtiRY6UNCPF6q4BxvNrxYiTUIBEGOkmjkNVJ15ljNbQ9jKHRkFtIzm4TitzLL 9V/bnFAqWMW0a5PyGDurvSgYIqhqlG5WlmB/KR55bUJr67IqnXCpDTr0nHn73J6rtg faMpNtxA+KCzQmPArAuEMZ6TOfIN9LHQVV8XXD9Mtq2q+hazERCRrZI2bCGpxr6+i/ ADEi1rzP+LrwDD6cZhQHENeG8Lvs3ZdUmYptzZT9hzfpqFxULVNXUXUR8qQoEvS2Es 8UpK1pAH/aRQadRrjt4jDHhuig4263sENJordRhaeUpdaumhcUMnMkH8FM7Ng6Wj2V au5Xq6mRyTUig== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin1.netcologne.de (Postfix) with ESMTP id C0EEF11ED5; Mon, 18 Feb 2019 23:03:26 +0100 (CET) Received: from [2001:4dd7:2221:0:7285:c2ff:fe6c:992d] (helo=cc-smtpin1.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5c6b2bae-5f8a-7f0000012729-7f0000019e22-1 for ; Mon, 18 Feb 2019 23:03:26 +0100 Received: from [IPv6:2001:4dd7:2221:0:7285:c2ff:fe6c:992d] (2001-4dd7-2221-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de [IPv6:2001:4dd7:2221:0:7285:c2ff:fe6c:992d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA; Mon, 18 Feb 2019 23:03:23 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 89384 Message-ID: <824f92e3-04b7-c309-6407-63b3e2634f6e@netcologne.de> Date: Mon, 18 Feb 2019 23:03:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 Hello world, this patch fixes the 9 regression in C interop with contiguous arguments recently reported by Reinhold Bader. ChangeLog and patch say it all. I hope I didn't overlook any obvious things here (Paul, maybe you can take a look). Regression-tested. OK for trunk? Regards Thomas 2019-02-18 Thomas Koenig PR fortran/89384 * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): If the dummy argument is contiguous and the actual argument may not be, use gfc_conv_subref_array_arg. 2019-02-18 Thomas Koenig PR fortran/89384 * gfortran.dg/ISO_Fortran_binding_4.f90 Index: trans-expr.c =================================================================== --- trans-expr.c (Revision 268992) +++ trans-expr.c (Arbeitskopie) @@ -4944,7 +4944,12 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc if (e->rank != 0) { - gfc_conv_expr_descriptor (parmse, e); + if (fsym->attr.contiguous + && !gfc_is_simply_contiguous (e, false, true)) + gfc_conv_subref_array_arg (parmse, e, false, fsym->attr.intent, + fsym->attr.pointer); + else + gfc_conv_expr_descriptor (parmse, e); if (POINTER_TYPE_P (TREE_TYPE (parmse->expr))) parmse->expr = build_fold_indirect_ref_loc (input_location,