[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 Tobias Burnus changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED CC||burnus at gcc dot gnu.org --- Comment #11 from Tobias Burnus --- FIXED (in GCC 12). Thanks Igor for the testcase!
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #10 from CVS Commits --- The master branch has been updated by Tobias Burnus : https://gcc.gnu.org/g:0cbf03689e3e7d9d6002b8e5d159ef3716d0404c commit r12-2511-g0cbf03689e3e7d9d6002b8e5d159ef3716d0404c Author: Tobias Burnus Date: Mon Jul 26 14:20:46 2021 +0200 PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handling Fortran: Fix attributes and bounds in ISO_Fortran_binding. 2021-07-26 José Rui Faustino de Sousa Tobias Burnus PR fortran/93308 PR fortran/93963 PR fortran/94327 PR fortran/94331 PR fortran/97046 gcc/fortran/ChangeLog: * 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: * 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: * 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.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #9 from José Rui Faustino de Sousa --- Created attachment 51018 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51018=edit Updated patch.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #8 from José Rui Faustino de Sousa --- Updated patch: https://gcc.gnu.org/pipermail/fortran/2021-June/056163.html
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 Dominique d'Humieres changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed||2021-05-30 Status|UNCONFIRMED |ASSIGNED --- Comment #7 from Dominique d'Humieres --- > Patch posted: > > https://gcc.gnu.org/pipermail/fortran/2021-May/056054.html The patch fixes this PR, see also pr94331.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 José Rui Faustino de Sousa changed: What|Removed |Added CC||jrfsousa at gcc dot gnu.org --- Comment #6 from José Rui Faustino de Sousa --- Patch posted: https://gcc.gnu.org/pipermail/fortran/2021-May/056054.html
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #5 from Igor Gayday --- I'd like to add that Gilles Gouaillardet is the author of the reproducer in my original post.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #4 from Gilles Gouaillardet --- I crafted the reproducer based on a previous one that has already been merged, and using a libc subroutine was not an issue back then. https://gcc.gnu.org/git?p=gcc.git;a=blob;f=gcc/testsuite/gfortran.dg/ISO_Fortran_binding_14.f90;h=388c5438252d49342f6bd357850062697fafb7b4;hb=980f185ce3ba6d532530ce0f23bfb6e30320fd8a But I get your point, and you can SUBROUTINE dummyc(x0) BIND(C, name="dummyc") and then in dummyc.c #include "ISO_Fortran_binding.h" void dummyc (CFI_cdesc_t * x){ } This does not change the fact that the test fails with GNU compilers though.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 --- Comment #3 from Steve Kargl --- On Mon, Sep 14, 2020 at 11:56:18PM +, gilles.gouaillardet at gmail dot com wrote: > This is the libc subroutine > > void sync(void); > > The point here is any subroutine (that will not cause a crash) can be used to > evidence the issue. > Isn't there a mismatch in the number of arguments provided by your Fortran code and the parameters expected in sync(2)? dummy (struct array15_unknown & restrict x0) { { void * cfi.0; x0->span = (integer(kind=4)) x0->dtype.elem_len; x0->dtype.attribute = 2; cfi.0 = 0B; _gfortran_gfc_desc_to_cfi_desc (, (struct array15_unknown *) x0); x0->dtype.attribute = 2; dummyc (cfi.0); _gfortran_cfi_desc_to_gfc_desc ((struct array15_unknown *) x0, ); __builtin_free (cfi.0); } } dummyc(cfi.0) becomes sync(cfi.0). Is this standard conform?
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 Gilles Gouaillardet changed: What|Removed |Added CC||gilles.gouaillardet at gmail dot c ||om --- Comment #2 from Gilles Gouaillardet --- This is the libc subroutine void sync(void); The point here is any subroutine (that will not cause a crash) can be used to evidence the issue.
[Bug fortran/97046] Bad interaction between lbound/ubound, allocatable arrays and bind(C) subroutine with dimension(..) parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97046 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Igor Gayday from comment #0) > Consider the following code: > > MODULE FOO > INTERFACE > SUBROUTINE dummyc(x0) BIND(C, name="sync") > type(*), dimension(..) :: x0 > END SUBROUTINE > END INTERFACE What are the implementation details for sync?