Skip to content

Commit

Permalink
[flang] Expand semantics test coverage of collective subroutines
Browse files Browse the repository at this point in the history
Add non-standard conforming calls that violate the intent(inout)
of errmsg argument for co_sum, co_max, co_min, and co_broadcast.
Add non-standard conforming calls that violate the argument
typing of errmsg argument for co_max, co_min, and co_broadcast.
Add standard conforming calls that reorder keyword arguments
for co_sum and co_reduce.

Reviewed By: ktras

Differential Revision: https://reviews.llvm.org/D128468
  • Loading branch information
ngeorge1098 authored and ktras committed Jun 30, 2022
1 parent a911914 commit e6d2916
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
5 changes: 5 additions & 0 deletions flang/test/Semantics/collectives01.f90
Expand Up @@ -33,6 +33,7 @@ program test_co_sum

! all arguments present
call co_sum(a=i, result_image=1, stat=status, errmsg=message)
call co_sum(result_image=1, a=i, errmsg=message, stat=status)

! one optional argument not present
call co_sum(a=i, stat=status, errmsg=message)
Expand Down Expand Up @@ -95,6 +96,10 @@ program test_co_sum
! 'errmsg' argument shall be noncoindexed
!ERROR: to be determined
call co_sum(c, errmsg=coindexed_character[1])

! 'errmsg' argument shall be a character
!ERROR: to be determined
call co_sum(c, errmsg=i)

! 'errmsg' argument shall be character scalar
!ERROR: 'errmsg=' argument has unacceptable rank 1
Expand Down
12 changes: 10 additions & 2 deletions flang/test/Semantics/collectives02.f90
Expand Up @@ -84,11 +84,19 @@ program test_co_min
! 'stat' argument shall be an integer scalar
!ERROR: 'stat=' argument has unacceptable rank 1
call co_min(i, stat=integer_array)


! 'errmsg' argument shall be intent(inout)
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'errmsg=' must be definable
call co_min(a=i, result_image=1, stat=status, errmsg='c')

! 'errmsg' argument shall be noncoindexed
!ERROR: to be determined
call co_min(c, errmsg=coindexed_character[1])


! 'errmsg' argument shall be a character
!ERROR: to be determined
call co_min(c, errmsg=i)

! 'errmsg' argument shall be character scalar
!ERROR: 'errmsg=' argument has unacceptable rank 1
call co_min(d, errmsg=character_array)
Expand Down
10 changes: 9 additions & 1 deletion flang/test/Semantics/collectives03.f90
Expand Up @@ -85,10 +85,18 @@ program test_co_max
!ERROR: 'stat=' argument has unacceptable rank 1
call co_max(i, stat=integer_array)

! 'errmsg' argument shall be intent(inout)
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'errmsg=' must be definable
call co_max(a=i, result_image=1, stat=status, errmsg='c')

! 'errmsg' argument shall be noncoindexed
!ERROR: to be determined
call co_max(c, errmsg=coindexed_character[1])


! 'errmsg' argument shall be a character
!ERROR: to be determined
call co_max(c, errmsg=i)

! 'errmsg' argument shall be character scalar
!ERROR: 'errmsg=' argument has unacceptable rank 1
call co_max(d, errmsg=character_array)
Expand Down
10 changes: 9 additions & 1 deletion flang/test/Semantics/collectives04.f90
Expand Up @@ -88,7 +88,15 @@ program test_co_broadcast
! 'errmsg' argument shall be noncoindexed
!ERROR: to be determined
call co_broadcast(c, errmsg=coindexed_character[1], source_image=1)


! 'errmsg' argument shall be a character
!ERROR: to be determined
call co_broadcast(c, 1, status, i)

! 'errmsg' argument shall be a character
!ERROR: to be determined
call co_broadcast(c, errmsg=i, source_image=1)

! 'errmsg' argument shall be character scalar
!ERROR: 'errmsg=' argument has unacceptable rank 1
call co_broadcast(d, errmsg=character_array, source_image=1)
Expand Down
4 changes: 3 additions & 1 deletion flang/test/Semantics/collectives05.f90
Expand Up @@ -52,6 +52,8 @@ program main
call co_reduce(string, operation=char_op, result_image=1, stat=status, errmsg=message)
call co_reduce(foo, operation=left, result_image=1, stat=status, errmsg=message)

call co_reduce(result_image=1, operation=left, a=foo, errmsg=message, stat=status)

allocate(foo_t :: polymorphic)

! Test all statically verifiable semantic requirements on co_reduce arguments
Expand Down Expand Up @@ -160,7 +162,7 @@ program main
!ERROR: to be determined
call co_reduce(i, int_op, result_image=1, stat=status, errmsg=conindexed_string[1])

! errmsg argument must be a scalar
! errmsg argument must be a character scalar
!ERROR: to be determined
call co_reduce(i, int_op, result_image=1, stat=status, errmsg=character_array)

Expand Down

0 comments on commit e6d2916

Please sign in to comment.