Hi everyone,

The following program produces incorrect results (GCC 11.2.0,
OpenCoarrays 2.9.2). The line marked `! NOTE` should print 1, 2, 3, 4,
but instead I get "OpenCoarrays internal error on image 2:
libcaf_mpi::caf_sendget_by_ref(): can not allocate 0 bytes of memory."

This may be an OpenCoarrays bug, rather than a GFortran bug (we're
reporting it there too), but if any of the gfortran developers are
able to confirm this or provide any insight that would be greatly
appreciated. Thank you!

program bug
    type :: container
        integer, allocatable :: stuff(:)
    end type

    type(container) :: co_containers(10)[*]

    if (this_image() == 1) then
        allocate(co_containers(2)%stuff(4))
        co_containers(2)%stuff = [1,2,3,4]
    end if

    sync all

    if (this_image() == 2) then
        print *, co_containers(2)[1]%stuff  ! NOTE
    end if
end program

Reply via email to