https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87556
Bug ID: 87556 Summary: FORM TEAM statement team-number argument interpreted incorrectly when function Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: weeks at iastate dot edu Target Milestone: --- Created attachment 44810 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44810&action=edit reproducer In the attached reproducer, the gfortran 8.2.0 FORM TEAM statement appears to misinterpret a team-number actual argument when it is a scalar-int-expr involving a function, but not when the result of this expression is first assigned to an integer variable that is then used as the team-number argument. The following output, using the OpenCoarrays compiler driver, contains 4 columns: current team, this_image() in initial team, this_image() in current team, and num_images() in current team. It looks correct for my_team1 (integer variable actual argument), and incorrect for my_team2 (scalar-int-expr involving a function). ======================================================== $ caf -std=f2018 -Wall -Wextra test_form_team.f90 $ cafrun -np 6 ./a.out | sort my_team1 1 1 3 my_team1 2 2 3 my_team1 3 3 3 my_team1 4 1 3 my_team1 5 2 3 my_team1 6 3 3 my_team2 1 1 6 my_team2 2 2 6 my_team2 3 3 6 my_team2 4 4 6 my_team2 5 5 6 my_team2 6 6 6 ======================================================== This seems like the issue gfortran front-end, rather than the OpenCoarrays library. Software versions: ======================================================== $ caf --version OpenCoarrays Coarray Fortran Compiler Wrapper (caf version 2.2.0-13-gb47afbc) Copyright (C) 2015-2018 Sourcery Institute Copyright (C) 2015-2018 Sourcery, Inc. OpenCoarrays comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of OpenCoarrays under the terms of the BSD 3-Clause License. For more information about these matters, see the file named LICENSE that is distributed with OpenCoarrays. $ caf -w caf wraps /opt/local/bin/gfortran-mp-8 $ /opt/local/bin/gfortran-mp-8 -dumpversion 8.2.0 $ mpiexec --version | head -n 2 HYDRA build details: Version: 3.3b3 ========================================================