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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:b9da28bcd9af4053544f191f2393a0c79e3d30ae

commit r17-4634-gb9da28bcd9af4053544f191f2393a0c79e3d30ae
Author: Jerry DeLisle <[email protected]>
Date:   Wed Sep 23 13:46:40 2026 -0700

    libgfortran: [PR127347] caf_shmem: do not wait for terminated images

    When an image terminated normally or with FAIL IMAGE, the other images
    kept counting it in their team barriers and blocked forever in the next
    SYNC ALL.  An image executing STOP or FAIL IMAGE now drops out of the
    barriers of every team it is a member of before it exits.  Lowering the
    count wakes the images already waiting once it reaches zero.

    An image executing STOP with a non-zero stop code records that it
    stopped and then exits with that code.  The supervisor marked every
    image exiting with a non-zero code as failed, so keep the status the
    image recorded, as is done for an image exiting with zero.

    SYNC IMAGES indexed its synchronization table with the team's image
    count as the row stride.  That count shrinks once an image has
    terminated, although the table is allocated for all images.  Use the
    total number of images, and handle an image list and * alike.

    Assisted-by: Claude Opus 5

            PR libfortran/127347

    libgfortran/ChangeLog:

            * caf/shmem.c (mark_stopped): New function.
            (_gfortran_caf_stop_numeric, _gfortran_caf_stop_str): Call it.
            (_gfortran_caf_fail_image): Call leave_teams.
            * caf/shmem/supervisor.c (supervisor_main_loop): Keep the status an
            image recorded for itself.
            * caf/shmem/sync.c (sync_table): Use the total number of images as
            the row stride.  Handle an image list and all images alike.
            * caf/shmem/teams_mgmt.c (leave_teams): New function.
            * caf/shmem/teams_mgmt.h (leave_teams): Declare.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/coarray/fail_image_sync_1.f90: New test.
            * gfortran.dg/coarray/stop_sync_1.f90: New test.
            * gfortran.dg/coarray/sync_images_stopped_1.f90: New test.

Reply via email to