public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components
@ 2015-02-05  8:38 burnus at gcc dot gnu.org
  2015-04-03 12:39 ` [Bug fortran/64944] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-02-05  8:38 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug fortran/64944] Coarrays not registered for structure constructor with allocatable coarray components
  2015-02-05  8:38 [Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components burnus at gcc dot gnu.org
@ 2015-04-03 12:39 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-04-03 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-03
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Compiling the given tests gives the error

Error: No initializer for component 'i' given in the structure constructor at
(1)!

If I replace 'm()' with 'm(1)', the first test compiles but segfault at run
time, while the two others give an ICE

 call foo(t(m(1)))
 1
internal compiler error: in fold_convert_loc, at fold-const.c:2357


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

end of thread, other threads:[~2015-04-03 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05  8:38 [Bug fortran/64944] New: Coarrays not registered for structure constructor with allocatable coarray components burnus at gcc dot gnu.org
2015-04-03 12:39 ` [Bug fortran/64944] " dominiq at lps dot ens.fr

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).