[PATCH 1/2] [PR126777] Fix TEAM_NUMBER under -fcoarray=single and lib
Mikael Morin
morin-mikael@orange.fr
Wed Sep 2 15:39:09 GMT 2026
Le 02/09/2026 à 11:17, Paul Richard Thomas a écrit :
> Hello Mikael,
>
> The new team is different to the parent team and so "I'm inclined to
> think that they are different teams, and the program should output
> (for each image): -1 and 12." is correct.
>
Thanks.
Then, it's also the expected output with -fcoarray=single, and
team_number shouldn't always return -1 even with -fcoarray=single.
> Expanding your example a bit:
> program prog
> use, intrinsic :: iso_fortran_env, only: team_type
> implicit none
> type(team_type) :: team1, team2
> print *, team_number()
> form team (mod (this_image (), 4) +1, team1)
> change team(team1)
> form team (mod (this_image (), 2) +1, team2)
> change team(team2)
> print *, team_number(team1), team_number(team2)
> end team
> end team
> end program
>
> Results in:
> pault@fedora:~/prs/coarrays$ export GFORTRAN_NUM_IMAGES=8
> pault@fedora:~/prs/coarrays$ rm ./a.out;rm
> *.original;~/gfc/bin/gfortran -fcoarray=lib -g ../junk.f90
> -lcaf_shmem;./a.out
> rm: cannot remove '*.original': No such file or directory
> -1
> -1
> -1
> -1
> -1
> -1
> -1
> -1
> 3 1
> 3 2
> 2 2
> 2 1
> 4 2
> 4 1
> 1 2
> 1 1
>
> The other brands do the same.
>
Yeah, but that case is clearer. My question was more focused on the
degenerate case where all images use the same number, and more
specifically the single-image behaviour.
More information about the Fortran
mailing list