diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp --- a/flang/lib/Evaluate/intrinsics.cpp +++ b/flang/lib/Evaluate/intrinsics.cpp @@ -629,6 +629,8 @@ // NULL() is a special case handled in Probe() below {"num_images", {}, DefaultInt, Rank::scalar, IntrinsicClass::transformationalFunction}, + {"num_images", {{"team", TeamType, Rank::scalar}}, DefaultInt, Rank::scalar, + IntrinsicClass::transformationalFunction}, {"num_images", {{"team_number", AnyInt, Rank::scalar}}, DefaultInt, Rank::scalar, IntrinsicClass::transformationalFunction}, {"out_of_range", diff --git a/flang/test/Semantics/num_images01.f90 b/flang/test/Semantics/num_images01.f90 --- a/flang/test/Semantics/num_images01.f90 +++ b/flang/test/Semantics/num_images01.f90 @@ -2,11 +2,17 @@ ! Check for semantic errors in num_images() function calls subroutine test + use iso_fortran_env, only: team_type + implicit none + + type(team_type) my_team ! correct calls, should produce no errors print *, num_images() print *, num_images(team_number=1) print *, num_images(1) + print *, num_images(my_team) + print *, num_images(team=my_team) ! incorrectly typed argument ! the error is seen as too many arguments to the num_images() call with no arguments @@ -25,6 +31,7 @@ !ERROR: unknown keyword argument to intrinsic 'num_images' print *, num_images(team_numbers=1) - !TODO: test num_images() calls related to team_type argument + !ERROR: unknown keyword argument to intrinsic 'num_images' + print *, num_images(teams=my_team) end subroutine diff --git a/flang/test/Semantics/num_images02.f90 b/flang/test/Semantics/num_images02.f90 --- a/flang/test/Semantics/num_images02.f90 +++ b/flang/test/Semantics/num_images02.f90 @@ -21,12 +21,8 @@ n = num_images(standard_initial_value) n = num_images(coindexed[1]) - !___ standard-conforming statements with team_type argument present (not yet supported) ___ - - !ERROR: too many actual arguments for intrinsic 'num_images' + !___ standard-conforming statements with team_type argument present ___ n = num_images(home) - - !ERROR: unknown keyword argument to intrinsic 'num_images' n = num_images(team=home) !___ non-conforming statements ___