From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id CCE2A3850416; Mon, 21 Jun 2021 13:46:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCE2A3850416 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 5cdfGFrsZxwDPZQljznK0XV9b5ZK99bPMGeyoyTONyjxALy9xH9THFFY4ULwumQJm3wPYiPoW5 lccGJV6QCVaQ7GVpUywpEAjAcfB5lBX8CaMwqwHsvUtnh+vWnlHRsgsEcjIZFe+QJLL/hI3L65 f4UUu/6lKLw60CKentzc9BmlZ/fCgyqbg4eTlxL1qGmc6mmBlEZm13YyGoKr+uakpcEXFMkizw /yziTg82VIXa8yaeoRrRqVu9kkJvJ5hSG29hre5US6aFD5UHFTtoFvlZt4Vq5DWUj37Un3FXJY WOg= X-IronPort-AV: E=Sophos;i="5.83,289,1616486400"; d="scan'208";a="62820108" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 21 Jun 2021 05:46:36 -0800 IronPort-SDR: MA4DxNedPssd4RF+tjVbJy8dbkjsXadMAZjMvW6dEU9FcusxHyZZzC3teYgKLzG6s61NdN/AhI dYJfbEw5KYgQaKI14f6rU8L9N+hlYvPSbB2HJh52wtZVK6AJphy6l/Gmq+ptEmT/wQ8JHuLy0Z pqEJp/Zq94PwHijj5d+FCuVRdJrh+99h0CNyNQ3s9WDg2arMO/C2zarn2fgAX81OkcPgpkNz12 4rQXIGYQAtSCXQ7OVdvNZRXPscJt8obwswSXUPpNsg5BF4JkqTe6eq/qV1OxTxmULVQl3UW3Q7 38g= Subject: Re: [Patch, fortran V2] PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handling To: =?UTF-8?Q?Jos=c3=a9_Rui_Faustino_de_Sousa?= , , References: <0b4b1feb-aa45-31ab-9185-546bd0cc551a@gmail.com> From: Tobias Burnus Message-ID: Date: Mon, 21 Jun 2021 15:46:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <0b4b1feb-aa45-31ab-9185-546bd0cc551a@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2021 13:46:38 -0000 Hi Jos=C3=A9, (in principle, I'd like to have the libgfortran function moved to the compiler proper to avoid some issues, but that's admittedly a task independent of your work.) On 15.06.21 01:09, Jos=C3=A9 Rui Faustino de Sousa via Fortran wrote: > Update to a proposed patch to: > Bug 93308 - bind(c) subroutine changes lower bound of array argument > in caller > Bug 93963 - Select rank mishandling allocatable and pointer arguments > with bind(c) > Bug 94327 - Bind(c) argument attributes are incorrectly set > Bug 94331 - Bind(C) corrupts array descriptors > Bug 97046 - Bad interaction between lbound/ubound, allocatable arrays > and bind(C) subroutine with dimension(..) parameter > ... > Patch tested only on x86_64-pc-linux-gnu. > Fix attribute handling, which reflect a prior intermediate version of > the Fortran standard. LGTM =E2=80=93 except for one minor nit. In trans-expr.c's gfc_conv_gfc_des= c_to_cfi_desc: /* Transfer values back to gfc descriptor. */ + if (cfi_attribute !=3D 2 + && !fsym->attr.value + && fsym->attr.intent !=3D INTENT_IN) Can you add after the '2' the string ' /* CFI_attribute_other. */' to make the number less magic. Thanks, Tobias > > CFI descriptors, in most cases, should not be copied out has they can > corrupt the Fortran descriptor. Bounds will vary and the original > Fortran bounds are definitively lost on conversion. > > Thank you very much. > > Best regards, > Jos=C3=A9 Rui > > Fortran: Fix attributtes and bounds in ISO_Fortran_binding. > > gcc/fortran/ChangeLog: > > PR fortran/93308 > PR fortran/93963 > PR fortran/94327 > PR fortran/94331 > PR fortran/97046 > * trans-decl.c (convert_CFI_desc): Only copy out the descriptor > if necessary. > * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Updated attribute > handling which reflect a previous intermediate version of the > standard. Only copy out the descriptor if necessary. > > libgfortran/ChangeLog: > > PR fortran/93308 > PR fortran/93963 > PR fortran/94327 > PR fortran/94331 > PR fortran/97046 > * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Add code > to verify the descriptor. Correct bounds calculation. > (gfc_desc_to_cfi_desc): Add code to verify the descriptor. > > gcc/testsuite/ChangeLog: > > PR fortran/93308 > PR fortran/93963 > PR fortran/94327 > PR fortran/94331 > PR fortran/97046 > * gfortran.dg/ISO_Fortran_binding_1.f90: Add pointer attribute, > this test is still erroneous but now it compiles. > * gfortran.dg/bind_c_array_params_2.f90: Update regex to match > code changes. > * gfortran.dg/PR93308.f90: New test. > * gfortran.dg/PR93963.f90: New test. > * gfortran.dg/PR94327.c: New test. > * gfortran.dg/PR94327.f90: New test. > * gfortran.dg/PR94331.c: New test. > * gfortran.dg/PR94331.f90: New test. > * gfortran.dg/PR97046.f90: New test. ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 M=C3=BCnchen R= egistergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas H= eurung, Frank Th=C3=BCrauf