From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26941 invoked by alias); 5 Feb 2015 08:38:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26894 invoked by uid 48); 5 Feb 2015 08:38:01 -0000 From: "burnus at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00425.txt.bz2 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.