This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/54262] New: LOC shouldn't use copy-in/copy-out


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]