public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54262] New: LOC shouldn't use copy-in/copy-out
@ 2012-08-14 20:49 burnus at gcc dot gnu.org
  2012-08-15  8:12 ` [Bug fortran/54262] " burnus at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-14 20:49 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/54262] LOC shouldn't use copy-in/copy-out
  2012-08-14 20:49 [Bug fortran/54262] New: LOC shouldn't use copy-in/copy-out burnus at gcc dot gnu.org
@ 2012-08-15  8:12 ` burnus at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-15  8:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54262

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-15 08:11:58 UTC ---
>From trans-intrinsics.c's gfc_conv_intrinsic_loc:

  if (ss == gfc_ss_terminator)
    gfc_conv_expr_reference (se, arg_expr);
  else
    gfc_conv_array_parameter (se, arg_expr, ss, true, NULL, NULL, NULL);

The "true" is for "bool g77" which causes the copy-in/copy-out.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-15  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 20:49 [Bug fortran/54262] New: LOC shouldn't use copy-in/copy-out burnus at gcc dot gnu.org
2012-08-15  8:12 ` [Bug fortran/54262] " burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).