[flang-commits] [flang] e6d2916 - [flang] Expand semantics test coverage of collective subroutines

Katherine Rasmussen via flang-commits flang-commits at lists.llvm.org
Thu Jun 30 14:33:52 PDT 2022


Author: Naje George
Date: 2022-06-30T14:30:44-07:00
New Revision: e6d29161fb2e49127cdc7428450b79839bd4ff4d

URL: https://github.com/llvm/llvm-project/commit/e6d29161fb2e49127cdc7428450b79839bd4ff4d
DIFF: https://github.com/llvm/llvm-project/commit/e6d29161fb2e49127cdc7428450b79839bd4ff4d.diff

LOG: [flang] Expand semantics test coverage of collective subroutines

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

Added: 
    

Modified: 
    flang/test/Semantics/collectives01.f90
    flang/test/Semantics/collectives02.f90
    flang/test/Semantics/collectives03.f90
    flang/test/Semantics/collectives04.f90
    flang/test/Semantics/collectives05.f90

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/collectives01.f90 b/flang/test/Semantics/collectives01.f90
index 66a0bbc3f8f3..e07a93fd3e96 100644
--- a/flang/test/Semantics/collectives01.f90
+++ b/flang/test/Semantics/collectives01.f90
@@ -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) 
@@ -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

diff  --git a/flang/test/Semantics/collectives02.f90 b/flang/test/Semantics/collectives02.f90
index 3fdf902a1912..64a3a765d57e 100644
--- a/flang/test/Semantics/collectives02.f90
+++ b/flang/test/Semantics/collectives02.f90
@@ -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)

diff  --git a/flang/test/Semantics/collectives03.f90 b/flang/test/Semantics/collectives03.f90
index 5983b5037888..9ef630bd3c29 100644
--- a/flang/test/Semantics/collectives03.f90
+++ b/flang/test/Semantics/collectives03.f90
@@ -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)

diff  --git a/flang/test/Semantics/collectives04.f90 b/flang/test/Semantics/collectives04.f90
index b182c216c5f9..4bfaf2999df3 100644
--- a/flang/test/Semantics/collectives04.f90
+++ b/flang/test/Semantics/collectives04.f90
@@ -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)

diff  --git a/flang/test/Semantics/collectives05.f90 b/flang/test/Semantics/collectives05.f90
index 5e8cbad1e13b..bf8cfeff8a33 100644
--- a/flang/test/Semantics/collectives05.f90
+++ b/flang/test/Semantics/collectives05.f90
@@ -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
@@ -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)
 


        


More information about the flang-commits mailing list