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

--- Comment #5 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:a1b67de3a4dc9ca745569a16c8cab33c0ee6ceca

commit r16-7735-ga1b67de3a4dc9ca745569a16c8cab33c0ee6ceca
Author: Andre Vehreschild <[email protected]>
Date:   Thu Feb 12 11:13:25 2026 +0100

    Fortran: Fix form team in caf_shmem [PR124071]

    Form team w/o new_index= tried to compute the new_index assuming that
    images are scattered onto to teams. I.e. the distribution is:

    Image index: 1 2 3 4 5 6
    New team no: 1 2 1 2 1 2 , i.e. scattered

    But this algorithm failed, when the images were linearly distributed
    into the new teams, like in:

    Image index: 1 2 3 4 5 6
    New team no: 1 1 1 2 2 2

    The new approach is to look up a free index in the new team, when the
    computed one is already taken.  Because F2018, 11.6.9, ยง4 states the
    new index is processor dependent, it feels safe to do it this way.

            PR fortran/124071

    libgfortran/ChangeLog:

            * caf/shmem.c (_gfortran_caf_form_team): Take free index, when
            computed one is already taken.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/coarray/form_team_1.f90: New test.

Reply via email to