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

            Bug ID: 127837
           Summary: caf_shmem: END TEAM does not report stopped or failed
                    images
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

With -fcoarray=lib and caf_shmem, END TEAM always sets STAT= to 0,
even when an image of the team being ended has stopped or failed.
Without STAT=, such an image does not cause error termination, which
F2023 11.7.11 requires.

Reproducer (GFORTRAN_NUM_IMAGES=2):

program end_team_stat
  use iso_fortran_env, only : team_type
  implicit none
  type(team_type) :: t
  integer :: st

  form team (1, t)
  change team (t)
    if (this_image () == num_images ()) stop
  end team (stat=st)
  print *, this_image (), st
end program end_team_stat

$ gfortran -fcoarray=lib end_team_stat.f90 -lcaf_shmem
$ GFORTRAN_NUM_IMAGES=2 ./a.out

Observed: image 1 prints st = 0.

Expected: image 1 prints st = STAT_STOPPED_IMAGE (STAT_FAILED_IMAGE
if the image executes FAIL IMAGE instead of STOP).  With
"end team" (no STAT=), the program should error terminate instead of
completing normally.

_gfortran_caf_end_team synchronizes with sync_team, whose barrier wait
discards the count of terminated images, and then sets STAT= to 0.

I have a patch that I will submit to the list

Reply via email to