gcc/libgfortran
Sandra Loosemore 93b6b2f614 libgfortran: Further fixes for GFC/CFI descriptor conversions.
This patch is for:
PR100907 - Bind(c): failure handling wide character
PR100911 - Bind(c): failure handling C_PTR
PR100914 - Bind(c): errors handling complex
PR100915 - Bind(c): failure handling C_FUNPTR
PR100917 - Bind(c): errors handling long double real

All of these problems are related to the GFC descriptors constructed
by the Fortran front end containing ambigous or incomplete
information.  This patch does not attempt to change the GFC data
structure or the front end, and only makes the runtime interpret it in
more reasonable ways.  It's not a complete fix for any of the listed
issues.

The Fortran front end does not distinguish between C_PTR and
C_FUNPTR, mapping both onto BT_VOID.  That is what this patch does also.

The other bugs are related to GFC descriptors only containing elem_len
and not kind.  For complex types, the elem_len needs to be divided by
2 and then mapped onto a real kind.  On x86 targets, the kind
corresponding to C long double is different than its elem_len; since
we cannot accurately disambiguate between a 16-byte kind 10 long
double from __float128, this patch arbitrarily prefers to interpret that as
the standard long double type rather than the GNU extension.

Similarly, for character types, the GFC descriptor cannot distinguish
between character(kind=c_char, len=4) and character(kind=ucs4, len=1).
But since the front end currently rejects anything other than len=1
(PR92482) this patch uses the latter interpretation.

2021-09-01  Sandra Loosemore  <sandra@codesourcery.com>
	    José Rui Faustino de Sousa  <jrfsousa@gmail.com>

gcc/testsuite/
	PR fortran/100911
	PR fortran/100915
	PR fortran/100916
	* gfortran.dg/PR100911.c: New file.
	* gfortran.dg/PR100911.f90: New file.
	* gfortran.dg/PR100914.c: New file.
	* gfortran.dg/PR100914.f90: New file.
	* gfortran.dg/PR100915.c: New file.
	* gfortran.dg/PR100915.f90: New file.

libgfortran/
	PR fortran/100907
	PR fortran/100911
	PR fortran/100914
	PR fortran/100915
	PR fortran/100917
	* ISO_Fortran_binding-1-tmpl.h (CFI_type_cfunptr): Make equivalent
	to CFI_type_cptr.
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Fix
	handling of CFI_type_cptr and CFI_type_cfunptr.  Additional error
	checking and code cleanup.
	(gfc_desc_to_cfi_desc): Likewise.  Also correct kind mapping
	for character, complex, and long double types.
2021-09-02 16:41:02 -07:00
..
caf Steve Kargl <kargl@gcc.gnu.org> 2021-05-22 13:27:42 +02:00
config Update copyright years. 2021-01-04 10:26:59 +01:00
generated PR libfortran/99218 - matmul on temporary array accesses invalid memory 2021-03-05 20:58:51 +01:00
ieee libgfortran: Fix PR95647 by changing the interfaces of operators .eq. and .ne. 2021-02-12 07:58:16 -08:00
intrinsics Fix "tailing" typo. 2021-06-08 09:42:18 +02:00
io Fix "tailing" typo. 2021-06-08 09:42:18 +02:00
m4 PR libfortran/99218 - matmul on temporary array accesses invalid memory 2021-03-05 20:58:51 +01:00
runtime libgfortran: Further fixes for GFC/CFI descriptor conversions. 2021-09-02 16:41:02 -07:00
acinclude.m4 Replace sync builtins with atomic builtins 2018-11-22 09:58:29 +02:00
aclocal.m4 Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
c99_protos.h Update copyright years. 2021-01-04 10:26:59 +01:00
ChangeLog Daily bump. 2021-08-28 00:16:42 +00:00
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018 Update copyright years. 2019-01-01 13:31:55 +01:00
ChangeLog-2019 Update copyright years. 2020-01-01 12:51:42 +01:00
ChangeLog-2020 Rotate ChangeLog files - part 1 - add ChangeLog-2020. 2021-01-01 17:27:52 +01:00
config.h.in libgfortran: Provide some further math library fallbacks [PR94694] 2020-04-22 21:34:19 +02:00
configure libgfortran: Use the libtool macro to determine libm availability. 2021-08-27 16:50:19 +01:00
configure.ac libgfortran: Use the libtool macro to determine libm availability. 2021-08-27 16:50:19 +01:00
configure.host aix: Add GCC64 configuration and FAT target libraries. 2020-06-21 14:14:46 -04:00
gfortran.map Steve Kargl <kargl@gcc.gnu.org> 2021-05-22 13:27:42 +02:00
ISO_Fortran_binding-1-tmpl.h libgfortran: Further fixes for GFC/CFI descriptor conversions. 2021-09-02 16:41:02 -07:00
ISO_Fortran_binding-2-tmpl.h Bind(C): Fix type encodings in ISO_Fortran_binding.h 2021-07-27 21:20:21 -07:00
ISO_Fortran_binding-3-tmpl.h Bind(C): Fix type encodings in ISO_Fortran_binding.h 2021-07-27 21:20:21 -07:00
kinds-override.h Update copyright years. 2021-01-04 10:26:59 +01:00
libgfortran.h Fortran: Fix some issues with pointers to character. 2021-06-05 11:12:50 +00:00
libgfortran.spec.in libgfortran: Use the libtool macro to determine libm availability. 2021-08-27 16:50:19 +01:00
libtool-version
Makefile.am libgfortran: Use the libtool macro to determine libm availability. 2021-08-27 16:50:19 +01:00
Makefile.in libgfortran: Use the libtool macro to determine libm availability. 2021-08-27 16:50:19 +01:00
mk-kinds-h.sh Bind(C): Fix type encodings in ISO_Fortran_binding.h 2021-07-27 21:20:21 -07:00
mk-sik-inc.sh libgfortran: Skip integer-kind=16 check for amdgcn 2020-07-26 07:20:24 +02:00
mk-srk-inc.sh libgfortran: Skip integer-kind=16 check for amdgcn 2020-07-26 07:20:24 +02:00