[Patch, fortran] PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handling
José Rui Faustino de Sousa
jrfsousa@gmail.com
Wed May 19 18:03:13 GMT 2021
Hi all!
Proposed patch to:
Bug 93308 - bind(c) subroutine changes lower bound of array argument in
caller
Bug 93963 - Select rank mishandling allocatable and pointer arguments
with bind(c)
Bug 94327 - Bind(c) argument attributes are incorrectly set
Bug 94331 - Bind(C) corrupts array descriptors
Bug 97046 - Bad interaction between lbound/ubound, allocatable arrays
and bind(C) subroutine with dimension(..) parameter
Patch tested only on x86_64-pc-linux-gnu.
Fix attribute handling, which reflect a prior intermediate version of
the Fortran standard.
CFI descriptors, in most cases, should not be copied out has they can
corrupt the Fortran descriptor. Bounds will vary and the original
Fortran bounds are definitively lost on conversion.
Thank you very much.
Best regards,
José Rui
Fortran: Fix attributtes and bounds in ISO_Fortran_binding.
gcc/fortran/ChangeLog:
PR fortran/93308
PR fortran/93963
PR fortran/94327
PR fortran/94331
PR fortran/97046
* trans-decl.c (convert_CFI_desc): Only copy out the descriptor
if necessary.
* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Updated attribute
handling which reflect a previous intermediate version of the
standard. Only copy out the descriptor if necessary.
libgfortran/ChangeLog:
PR fortran/93308
PR fortran/93963
PR fortran/94327
PR fortran/94331
PR fortran/97046
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Add code
to verify the descriptor. Correct bounds calculation.
(gfc_desc_to_cfi_desc): Add code to verify the descriptor.
gcc/testsuite/ChangeLog:
PR fortran/93308
PR fortran/93963
PR fortran/94327
PR fortran/94331
PR fortran/97046
* gfortran.dg/ISO_Fortran_binding_1.f90: Add pointer attribute,
this test is still erroneous but now it compiles.
* gfortran.dg/bind_c_array_params_2.f90: Update regex to match
code changes.
* gfortran.dg/PR93308.f90: New test.
* gfortran.dg/PR93963.f90: New test.
* gfortran.dg/PR94327.c: New test.
* gfortran.dg/PR94327.f90: New test.
* gfortran.dg/PR94331.c: New test.
* gfortran.dg/PR94331.f90: New test.
* gfortran.dg/PR97046.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PR93308-93963-94327-94331-97046.patch
Type: text/x-patch
Size: 32124 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20210519/9563814b/attachment-0001.bin>
More information about the Fortran
mailing list