From: Sandra Loosemore <sandra@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: [PATCH 0/3] [PR libfortran/101305] Bind(C): Fix kind/size mappings
Date: Tue, 13 Jul 2021 15:28:55 -0600 [thread overview]
Message-ID: <20210713212859.1532449-1-sandra@codesourcery.com> (raw)
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
next reply other threads:[~2021-07-13 21:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 21:28 Sandra Loosemore [this message]
2021-07-13 21:28 ` [PATCH 1/3] [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h Sandra Loosemore
2021-07-21 10:03 ` Tobias Burnus
2021-07-13 21:28 ` [PATCH 2/3] [PR libfortran/101305] Bind(C): Correct sizes of some types in CFI_establish Sandra Loosemore
2021-07-21 9:48 ` Tobias Burnus
2021-07-13 21:28 ` [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite Sandra Loosemore
2021-07-21 10:17 ` Tobias Burnus
2021-07-23 14:15 ` Tobias Burnus
2021-07-23 20:43 ` Sandra Loosemore
2021-07-26 9:45 ` Tobias Burnus
2021-07-26 20:13 ` Sandra Loosemore
2021-07-28 4:36 ` Sandra Loosemore
2021-07-28 11:22 ` [Patch] gfortran.dg/dg.exp: Add libgfortran as -I flag for ISO*.h [PR101305] (was: [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite) Tobias Burnus
2021-07-28 22:56 ` Jakub Jelinek
2021-07-29 7:09 ` Jakub Jelinek
2021-07-29 9:51 ` [Patch] testsuite/lib/gfortran.exp: Add -I for ISO*.h [PR101305, PR101660] (was: Re: [Patch] gfortran.dg/dg.exp: Add libgfortran as -I flag for ISO*.h [PR101305] (was: [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite)) Tobias Burnus
2021-08-09 10:50 ` committed – " Tobias Burnus
2021-08-04 9:00 ` [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite Andreas Schwab
2021-08-09 10:52 ` Tobias Burnus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210713212859.1532449-1-sandra@codesourcery.com \
--to=sandra@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).