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.
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.
Paul
On Wed, 2 Sept 2026 at 09:39, Mikael Morin <[email protected]> wrote:
>
> Hello,
>
> what is not clear to me is what the expected output is for the following
> program:
>
> program prog
> use, intrinsic :: iso_fortran_env, only: team_type
> implicit none
> type(team_type) :: team
> print *, team_number()
> form team (12, team)
> change team(team)
> print *, team_number()
> end team
> end program
>
> This program tries to answer the question:
> A child team containing exactly the same images as its parent, is it the
> same team or is it a different team from its parent?
>
> I'm inclined to think that they are different teams, and the program
> should output (for each image): -1 and 12.
>
> With the other answer possible, meaning they are the same team, I expect
> the output to be -1 twice.
>
> I would like to answer the question above first before reviewing your patch.
>
> Mikael