public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components
Date: Thu, 05 Feb 2015 08:38:00 -0000	[thread overview]
Message-ID: <bug-64944-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64944

            Bug ID: 64944
           Summary: Coarrays not registered for structure constructor with
                    allocatable coarray components
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: pault at gcc dot gnu.org

Follow up to PR64757 and https://gcc.gnu.org/ml/fortran/2015-02/msg00022.html

"[...] I wonder whether we need to take care of:

type m
  integer :: i
end type m
type t
  CLASS(m), allocatable :: caf[:]
end type t
type(t), save :: x = t(m())
end

"We probably do. I think that's valid as it is (kind of) statically allocated.
That means we need to call for -fcoarray=lib the _gfortran_caf_register
function for x%caf as constructor (in the C sense) - such that the address is
registered at program start up. The (pointer) assignment of that address to
x%caf can be done later, e.g. when the procedure (or __MAIN) is actually
entered."


Thinking about it, I wonder what happens if one uses:

call foo(t(m()))
contains
subroutine foo(y)
  type(t) :: y
end subroutine foo

In that case, one surely doesn't want to allocate a coarray on all images.


And finally, the following probably works fine - but it has to continue to do
so:

  type(t) :: y
  y = t(m())

in that case, the RHS shall not allocate a coarray - but just do assign to the
LHS. The rules of intrinsic assignment require that the user ensures that y%caf
has the same allocation status and shape/type as on the RHS.


             reply	other threads:[~2015-02-05  8:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05  8:38 burnus at gcc dot gnu.org [this message]
2015-04-03 12:39 ` [Bug fortran/64944] " dominiq at lps dot ens.fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-64944-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).