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 6BAA3385781D; Tue, 13 Jul 2021 21:29:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6BAA3385781D 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: jLzXnpUZc+oci375YJ4DGLS4Bbv4xy5W1vq3Tkgs5xivTGIaiFJs7vn3sOVY0TKS2++94nhxq8 Oki5QOsNeCGQ9cnLnrGE2ewkaECj7nIRh9Kgy/W199yEWMG0AEea1mt+yYCQE6QGaI6s5MLXDI St3b0Ei5dUai1sQmBlKQOFPeLW94pYbPzS1hYx3MFn5wjDUEJVo/NXAv6w3dKc18LJEz+ocZoS ac2kLavrZ5Y0zhpzslW+QxIazQ0k5M2Dxe+yb92nFPsQqInWECopAgEacCL1uRJDBD3IGKJA5Y hjE= X-IronPort-AV: E=Sophos;i="5.84,237,1620720000"; d="scan'208";a="63657437" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 13 Jul 2021 13:29:21 -0800 IronPort-SDR: vJS4rZ/adswNo2gGsrzGVmtpu5XfzgnMPhLjFJ+iHW5Kh89VZJVFwHDhLybSaW69ehdWezyenU AvbKib0Wkti769drbiGFpJEmhG7TSqFEhIl6Y9z8sotDJohegHxUZKPZut//pqNv8lJqISuoSI 1JucsOtILX4Q+mdOjrOXbqMycc5jKiaSKjBjCGn/3hA5AkUtIRL7ckqTcGpgJFAbZPxgrZo7jU FfNmLiU+5QFPK4MS6vZr8C/1VB3bmWcpOcUwkjb4EMnL97fx81NUjbE+/jc0K3otPOcgm3DheI lmE= From: Sandra Loosemore To: , Subject: [PATCH 0/3] [PR libfortran/101305] Bind(C): Fix kind/size mappings Date: Tue, 13 Jul 2021 15:28:55 -0600 Message-ID: <20210713212859.1532449-1-sandra@codesourcery.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, 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: 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: Tue, 13 Jul 2021 21:29:24 -0000 This set of patches is for PR libfortran/101305, about bugs in ISO_Fortran_binding.h's type kind/size encodings, and also incorrect kind/size mappings in CFI_establish. For instance, ISO_Fortran_binding.h had hard-wired encodings that ptrdiff_t and long are 8 bytes that are clearly incorrect on a 32-bit target, and other encodings like CFI_type_int_fast8_t and CFI_type_long_double were incorrect on some 64-bit targets too. So part of this patch involves using sizeof in the CFI_type_* macro definitions, instead of literal constants. Another difficulty is that the 2018 Fortran standard requires that the CFI_type_* macros for C types not supported by the Fortran processor have negative values. Tobias contributed some scripting to check for that; now ISO_Fortran_binding.h is generated at build time from fragments in the libgfortran source directory. The remaining parts of the patch fix up related bugs in CFI_establish for types whose size isn't directly encoded in the corresponding CFI_type_* macro, and adjust include paths for ISO_Fortran_binding.h in the test suite. Jose has posted a patch that fixes some additional bugs in type/size encodings in descriptors passed to and from C: https://gcc.gnu.org/pipermail/fortran/2021-June/056154.html and there remains a messy bug (PR fortran/100917) relating to ambiguity in handling long double on some targets -- specifically, on x86_64 targets that have both 80-bit long doubles with a storage size of 16 and a true 128-bit floating-point format, the GFC descriptor representation can't tell them apart. I tested these patches on i686-pc-linux-gnu with both -m32 and -m64 multilibs. Sandra Loosemore (3): [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h [PR libfortran/101305] Bind(C): Correct sizes of some types in CFI_establish [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c | 2 +- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c | 2 +- .../gfortran.dg/bind_c_array_params_3_aux.c | 2 +- .../iso_fortran_binding_uint8_array_driver.c | 2 +- gcc/testsuite/gfortran.dg/pr93524.c | 2 +- libgfortran/ISO_Fortran_binding-1-tmpl.h | 196 ++++++++++++++++++++ libgfortran/ISO_Fortran_binding-2-tmpl.h | 42 +++++ libgfortran/ISO_Fortran_binding-3-tmpl.h | 5 + libgfortran/ISO_Fortran_binding.h | 206 --------------------- libgfortran/Makefile.am | 15 +- libgfortran/Makefile.in | 16 +- libgfortran/mk-kinds-h.sh | 25 ++- libgfortran/runtime/ISO_Fortran_binding.c | 21 ++- 25 files changed, 319 insertions(+), 241 deletions(-) create mode 100644 libgfortran/ISO_Fortran_binding-1-tmpl.h create mode 100644 libgfortran/ISO_Fortran_binding-2-tmpl.h create mode 100644 libgfortran/ISO_Fortran_binding-3-tmpl.h delete mode 100644 libgfortran/ISO_Fortran_binding.h -- 2.8.1