Hi all,

We've noticed that if you create a derived type with a member variable
and an accessor method, calling that accessor method on a coindexed
object on a remote image results in a segmentation fault at runtime,
as per the example below.

The following program should print "1, 2, 3" twice if run with 2
images. Instead, image 1 prints "1, 2, 3" but image 2 crashes with a
segmentation fault. Note that if you replace "mailbox[1]%stuff()" with
"mailbox[1]%stuff_" then it works correctly.

module container_m
    type :: container_t
        integer, allocatable :: stuff_(:)
    contains
        procedure :: stuff
    end type
contains
    function stuff(self)
        class(container_t), intent(in) :: self
        integer, allocatable :: stuff(:)
        stuff = self%stuff_
    end function
end module

program main
    use container_m
    type(container_t) :: mailbox[*]
    if (this_image() == 1) then
        allocate(mailbox%stuff_(3))
        mailbox%stuff_ = [1, 2, 3]
    end if
    sync all
    print *, mailbox[1]%stuff()
end program

I am using OpenCoarrays 2.9.2 and gfortran 11.1.1.

Thanks everyone,
Harris Snyder

Reply via email to