re PR fortran/89385 (Incorrect members of C descriptor for an allocatable object)
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 23 Feb 2019 12:18:44 +0000 (12:18 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sat, 23 Feb 2019 12:18:44 +0000 (12:18 +0000)
commitc280838969d504e909e1f1f4e19642e91fab982f
tree0d97a4275e8f81a6df83f1a711e9d0f11a88d493
parentace857f95d819377507f81ff4fc88ebf8b913eef
re PR fortran/89385 (Incorrect members of C descriptor for an allocatable object)

2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/89385
PR fortran/89366
* decl.c (gfc_verify_c_interop_param): Restriction on string
length being one is lifted for F2018.
* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): For scalar
characters with intent in, make a temporary and copy the result
of the expression evaluation into it.
(gfc_conv_procedure_call): Set a flag for character formal args
having a character length that is not unity. If the procedure
is bind C, call gfc_conv_gfc_desc_to_cfi_desc in this case.
Also, extend bind C calls to unconditionally convert both
pointers and allocatable expressions.

2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/89385
* gfortran.dg/ISO_Fortran_binding_1.f90 : Correct test for
previously incorrect lbound for allocatable expressions. Also
correct stop values to avoid repetition.
* gfortran.dg/ISO_Fortran_binding_5.f90 : New test
* gfortran.dg/ISO_Fortran_binding_5.c : Support previous test.

PR fortran/89366
* gfortran.dg/ISO_Fortran_binding_6.f90 : New test
* gfortran.dg/ISO_Fortran_binding_6.c : Support previous test.
* gfortran.dg/pr32599.f03 : Set standard to F2008.

2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/89385
PR fortran/89366
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc) : In the
interchange between character and derived, the character type
was being set incorrectly.
(gfc_desc_to_cfi_desc) : Eliminate the interchange of types in
this function. Do not add the kind and length information to
the type field of structures. Lbounds were incorrectly being
set to zero for allocatable and pointer descriptors. Should
have been non-pointer, non-allocatables that received this
treatment.

From-SVN: r269156
12 files changed:
gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f90
gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr32599.f03
libgfortran/ChangeLog
libgfortran/runtime/ISO_Fortran_binding.c