[flang] Add team_type to num_images intrinsic call

num_images had previously been added to the list of intrinsics
before the type team_type had been implemented. Now that team_type
is implemented, add the num_images call that has the team argument.
Update the semantics tests for num_images.

Reviewed By: craig.rasmussen

Differential Revision: https://reviews.llvm.org/D126734
This commit is contained in:
Katherine Rasmussen 2022-05-31 13:15:54 -07:00
parent e7c72d69ac
commit 473d780692
3 changed files with 11 additions and 6 deletions

View File

@ -629,6 +629,8 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
// 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",

View File

@ -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 @@ subroutine test
!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

View File

@ -21,12 +21,8 @@ program num_images_with_team_type
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 ___