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: unassig...@gcc.gnu.org ReportedBy: bur...@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