[Bug fortran/54262] New: LOC shouldn't use copy-in/copy-out
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 14 20:49:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54262
Bug #: 54262
Summary: LOC shouldn't use copy-in/copy-out
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
With CONTIGUOUS, the following program assigns the address of x->data to the C
pointer. However, without CONTIGUOUS one gets a copy-in/copy-out.
Expected: Also without CONTIGUOUS, one obtains the x->data address – and no
array is packed.
The expected result is in line with F2008/TS29113's handling of C_LOC.
Implementation: It might be possible to generate an interface for LOC where the
dummy is of "type(*), dimension(..)" – that could be sufficient, but for
scalars it requires a wrapper.
Test case:
subroutine foo(x, p)
use iso_c_binding
type(*), target, CONTIGUOUS :: x(..) ! or x(:)
type(c_ptr) :: p
p = transfer (loc(x), p)
end subroutine foo
More information about the Gcc-bugs
mailing list