From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 6FB1638618FC; Thu, 22 Jul 2021 08:03:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6FB1638618FC 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: PY6jmpATLFiJ9X3KVe5lep7PNzAsJY6do5jQc4rzRkMj0SE1Ep/g0ZF3BD8yap6UU+SzDDEgwv 01ztar780ADg9012XEmYsFxeqbybzmx17d4NbUFG1Fd5xzoexbSOnD/J7Xx2dUENryoHGpi+og DeWmqdTSrfDcSRVQ/KpKyZ9KuW2mAN/Y6v9SFNaIQ9f2NUPhqzIVo/KLTQ8FeFTVSr2ooPHgHd 7Buqg2f4TAU1ZSg887WgG/saq2Y0F9aosTFWf9oT5KBTGJFGmN1jOZub+NZgsyE+A4wU7oMXji NNXyNye/QHR2/INawhZD6UcL X-IronPort-AV: E=Sophos;i="5.84,260,1620720000"; d="scan'208";a="63799106" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 22 Jul 2021 00:03:49 -0800 IronPort-SDR: 2ErTbsk6U+3HkdreLP65Zl/KV+DMM1BY6SDZnMtuppdq2qnCNUunLOuLJbUyFErs1GDNZw3XBN fhk48/L3UiPmXLNy9U8mHwT9dAyNRKPUmbDVyQZ3d2VJOflmXFjKKZoMQ8qDoiEZWBE284m3v9 +k0XGrTBOtj4dmOHk2tystUeHeWFlC4vK5fuATY6vetbyH/6opnGgxmfhGaUbzX5hZLLSOm9oI QAwab1CvjHhtckUh8+7WmBLXy5+Z+et4n2tzhRlrxcHdqZ2owOKBv8of0rzh1XJwIZzEkw5Uih IA8= Subject: Re: [PATCH, Fortran] Bind(c): CFI_signed_char is not a Fortran character type To: Sandra Loosemore , "gcc-patches@gcc.gnu.org" , "fortran@gcc.gnu.org" References: <13168f92-8863-cb63-9470-a6055d5da5f6@codesourcery.com> From: Tobias Burnus Message-ID: Date: Thu, 22 Jul 2021 10:03:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <13168f92-8863-cb63-9470-a6055d5da5f6@codesourcery.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=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Thu, 22 Jul 2021 08:03:56 -0000 On 16.07.21 05:46, Sandra Loosemore wrote: > When I was reading code in conjunction with fixing PR101317, I noticed > an unrelated bug in the implementation of CFI_allocate and > CFI_select_part: they were mis-handling the CFI_signed_char type as > if it were a Fortran character type for the purposes of deciding > whether to use the elem_len argument to those functions. It's really > an integer type that has the size of signed char. I checked similar > code in other functions in ISO_Fortran_binding.c and these were the > only two that were incorrect. I think there was at least one other place, but that one has been fixed in the meanwhile, missing the other two occurrences you found. > Bind(c): signed char is not a Fortran character type > > CFI_allocate and CFI_select_part were incorrectly treating > CFI_type_signed_char as a Fortran character type for the purpose of > deciding whether or not to use the elem_len argument. It is a Fortr= an > integer type per table 18.2 in the 2018 Fortran standard. > > Other functions in ISO_Fortran_binding.c appeared to handle this cas= e > correctly already. > > 2021-07-15 Sandra Loosemore > > gcc/testsuite/ > * gfortran.dg/ts29113/library/allocate-c.c (ctest): Also test > handling of elem_len for CFI_type_char vs CFI_type_signed_char. > * gfortran.dg/ts29113/library/select-c.c (ctest): Likewise. > > libgfortran/ > * runtime/ISO_Fortran_binding.c (CFI_allocate) LGTM. Thanks! Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955