This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Feb 2015 08:37:59 +0000
- Subject: [Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components
- Auto-submitted: auto-generated
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.