[Bug fortran/101304] New: Bind(C): CONTIGUOUS attribute not handled correctly in Fortran routines called from C with discontiguous argument
sandra at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jul 3 04:50:12 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101304
Bug ID: 101304
Summary: Bind(C): CONTIGUOUS attribute not handled correctly in
Fortran routines called from C with discontiguous
argument
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: sandra at gcc dot gnu.org
Target Milestone: ---
Section 18.3.6 of the Fortran 2018 standard says:
"When an interoperable Fortran procedure that is invoked from C has a dummy
argument with the CONTIGUOUS attribute or that is an assumed-length CHARACTER
explicit-shape or assumed-size array, and the actual argument is the address of
a C descriptor for a discontiguous object, the Fortran processor shall handle
the
difference in contiguity."
This is not working properly. The bug is exposed by test cases
interoperability/contiguous-2.f90 and interoperability/contiguous-3.f90 from
the WIP TS29113 testsuite:
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574115.html
It looks like ftest1 is getting an array that starts at the correct offset of
the discontiguous section but has lost the non-unit sm from the base array.
Calling ftest1 and ftest2 directly from Fortran with a discontiguous array
section works correctly.
More information about the Gcc-bugs
mailing list