libgfortran: Set END TEAM STAT= for stopped and failed images
libgfortran: Fix END TEAM to correctly report STAT= for stopped/failed images, adhering to F2023 standard.
This change corrects libgfortran’s handling of the END TEAM statement in coarray Fortran. Previously, it incorrectly returned STAT=0 even when images within the team had stopped or failed, violating the F2023 standard. The fix ensures that END TEAM now correctly reports a non-zero STAT= for such cases by incorporating a team health check after deallocating coarrays.
In Details
The _gfortran_caf_end_team function in libgfortran's shmem backend previously synchronized using sync_team, which masked image termination status. This commit modifies it to use counter_barrier_wait with a new TERMINATED argument. This allows TEAM_HEALTH_CHECK to report the correct STAT= value when images have stopped or failed, fulfilling F2023 11.7.11 requirements.
- coarray Fortran
- An extension to the Fortran programming language that provides built-in support for parallel programming, allowing programmers to easily express data-parallel and task-parallel computations using 'coarrays'.
- END TEAM
- A statement in coarray Fortran used to end a team of images, potentially returning a status code indicating the outcome of the team's execution.
- STAT=
- A status specifier in Fortran that receives an integer value indicating the success or failure of an operation. A value of 0 typically indicates success.
- F2023
- The latest revision of the Fortran programming language standard, which includes features and clarifications for coarray Fortran.