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

            Bug ID: 126781
           Summary: NUM_IMAGES intrinsic missing keyword arguments
           Product: gcc
           Version: 16.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dobonachea at lbl dot gov
                CC: damian at archaeologic dot codes
  Target Milestone: ---

gfortran 16.2.0 is missing support for keyword arguments on the NUM_IMAGES
intrinsic.

Demonstration program, which compiles and executes correctly on NAG 7.2:
---------------------------------------------------------
cgpu$ cat num_images.F90                      
program test_num_images
  use iso_fortran_env
  implicit none

  integer :: res(5)

  if (this_image() == 1) then

    ! num_images works without teams:    
    res(1) = num_images()  ! works

    ! or with positional arguments:
    res(2) = num_images(GET_TEAM())
    res(3) = num_images(TEAM_NUMBER()) 

    ! keyword arguments are not correctly implemented:
    res(4) = num_images(TEAM=GET_TEAM())
    res(5) = num_images(TEAM_NUMBER=TEAM_NUMBER()) 

    print *, "------------------------------------------------"
    print *, "Results   : ", res

  end if

end program test_num_images

cgpu$ gfortran -c -fcoarray=lib num_images.F90
num_images.F90:17:13:

   17 |     res(4) = num_images(TEAM=GET_TEAM())
      |             1
Error: Cannot find keyword named 'team' in call to 'num_images' at (1)
num_images.F90:18:13:

   18 |     res(5) = num_images(TEAM_NUMBER=TEAM_NUMBER())
      |             1
Error: Cannot find keyword named 'team_number' in call to 'num_images' at (1)

cgpu$ gfortran --version
GNU Fortran (GCC) 16.2.0
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

---------------------------------------------------------

Reply via email to