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 C7E2E3894421; Wed, 21 Jul 2021 10:03:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C7E2E3894421 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: n6NrsTrGstd27irB3AMpsV4MnDfSuR16wzF/I0FdOuH0FhVUPPRQnkoYSGVbAa3XI0JbTyoOzw uXvXRu/mCO713Vo9/RnMskOWWBVWwUfMbOUFxsOD7eMvcfrKcVt5vwDZu4V0mBBHszAfQsqkHZ f4Rb+M9JS/X5A3ZxbdymJryZ7xXzIjDGd3uyIgF5686cSJiokTQ+Kl+MrxTk/Gs+Ek7HJTfG9b AnS3eNj4XHBQLv/6xv5Pk4yFeAojAjdRz3gWm34jtXdDTOU/0Kye7fpzMBCGJzKNJGz3VDXOX5 4AIYyNh8ybVYDgHTg/umK9rK X-IronPort-AV: E=Sophos;i="5.84,257,1620720000"; d="scan'208";a="63760373" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 21 Jul 2021 02:03:50 -0800 IronPort-SDR: 0Y8Tqt0FaBtHG923R0TDOMdkcIwnANTVHuAy76oSQUrPkndknPn+y2ELZQ+iFbdvV5ZAsskGrK HNhaC0Xxjpsjn8CNFCjGSKseE238TC8Q9JUvRDfj2JMVeEswexrjSB3zF4urr7kwiSwz2JtKaa 6v23ZSuPFLvqIUFYA1pjxrp04hhULXNal9zQ82+lEOKfB62AC7oWJ9bDA6EKGuqmVcLHNwrmyY r1y9Oc9nqob/NH4j18Ay0km/Qaa+TL5ZJ8q2eOXfL7YRZE/Leu5ADdz46E+4mtiEe6ZAEyTBnD J+c= Subject: Re: [PATCH 1/3] [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h To: Sandra Loosemore , , References: <20210713212859.1532449-1-sandra@codesourcery.com> <20210713212859.1532449-2-sandra@codesourcery.com> From: Tobias Burnus Message-ID: <836eba04-132f-8e1e-fd99-0b0d6058c7f1@codesourcery.com> Date: Wed, 21 Jul 2021 12:03:42 +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: <20210713212859.1532449-2-sandra@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-02.mgc.mentorg.com (139.181.222.2) 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 21 Jul 2021 10:03:52 -0000 On 13.07.21 23:28, Sandra Loosemore wrote: > ISO_Fortran_binding.h had many incorrect hardwired kind encodings in > the definitions of the CFI_type_* macros. Additionally, not all > targets support all the defined type encodings, and the Fortran > standard requires those macros to have a negative value. > > This patch changes ISO_Fortran_binding.h to use sizeof instead of > hard-coded sizes, and assembles it from fragments that reflect the > set of types supported by the target. > > 2021-07-13 Sandra Loosemore > Tobias Burnus > > libgfortran/ > PR libfortran/101305 > * ISO_Fortran_binding.h: Fix hard-coded sizes and split into... > * ISO_Fortran_binding-1-tmpl.h: New file. > * ISO_Fortran_binding-2-tmpl.h: New file. > * ISO_Fortran_binding-3-tmpl.h: New file. > * Makefile.am: Add rule for generating ISO_Fortran_binding.h. > Adjust pathnames to that file. > * Makefile.in: Regenerated. > * mk-kinds-h.sh: New file. > * runtime/ISO_Fortran_binding.c: Fix include path. LGTM =E2=80=93 except for the following remark regarding a preexisting comm= ent. > --- /dev/null > +++ b/libgfortran/ISO_Fortran_binding-1-tmpl.h > +/* Error codes. > + CFI_INVALID_STRIDE should be defined in the standard because they are= useful to the implementation of the functions. > + */ The standard permits: "Error conditions other than those listed in this subclause should be indicated by error codes different from the values of the macros named in this subclause." I personally do not like current (preexisting) the wording in the comment =E2=80=93 and CFI_FAILURE is also not listed, which is also not par= t of Fortran standard. I think some wording along the following is be more appropriate: "Note that CFI_FAILURE and CFI_INVALID_STRIDE specific to GCC and not part of the Fortran standard." > +#define CFI_SUCCESS 0 > +#define CFI_FAILURE 1 > +#define CFI_ERROR_BASE_ADDR_NULL 2 > +#define CFI_ERROR_BASE_ADDR_NOT_NULL 3 > +#define CFI_INVALID_ELEM_LEN 4 > +#define CFI_INVALID_RANK 5 > +#define CFI_INVALID_TYPE 6 > +#define CFI_INVALID_ATTRIBUTE 7 > +#define CFI_INVALID_EXTENT 8 > +#define CFI_INVALID_STRIDE 9 > +#define CFI_INVALID_DESCRIPTOR 10 > +#define CFI_ERROR_MEM_ALLOCATION 11 > +#define CFI_ERROR_OUT_OF_BOUNDS 12 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