public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3] [PR libfortran/101305] Bind(C): Fix kind/size mappings
@ 2021-07-13 21:28 Sandra Loosemore
  2021-07-13 21:28 ` [PATCH 1/3] [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h Sandra Loosemore
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Sandra Loosemore @ 2021-07-13 21:28 UTC (permalink / raw)
  To: gcc-patches, fortran

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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-08-09 10:53 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 21:28 [PATCH 0/3] [PR libfortran/101305] Bind(C): Fix kind/size mappings Sandra Loosemore
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

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).