program sync1
implicit none
integer :: iam
real :: x[*]
iam = this_image()

if (iam == 1) then
    x = 1.0
end if
sync memory

call external_sync()
sync memory(stat = status)

if (iam == 2) then
    write(*, *) x[1]
end if

if (this_image() == 1) then
    sync images(*)
else
    sync images(1, stat = status)
end if

end program sync1
