[flang-commits] [PATCH] D113077: [flang] Add a semantics test for co_min

Damian Rouson via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Nov 4 17:30:14 PDT 2021


rouson updated this revision to Diff 384921.
rouson added a comment.

1. Add co_min test to expectedly failed list.
2. Replaced non-ASCII characters.
3. Correct expected error message.
4. Update run directive to use test_errors.py.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113077/new/

https://reviews.llvm.org/D113077

Files:
  flang/test/Semantics/collectives02.f90


Index: flang/test/Semantics/collectives02.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/collectives02.f90
@@ -0,0 +1,46 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! XFAIL: *
+! Check for semantic errors in co_min() subroutine calls
+! To Do: add co_min to the evaluation stage
+
+module test_co_min
+  implicit none
+
+contains
+
+  subroutine test
+  
+    integer i, status
+    real vector(1)
+    real array(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1)
+    character(len=1) string, message
+  
+    ! correct calls, should produce no errors
+    call co_min(i)
+    call co_min(i,   1)
+    call co_min(i,   1,              status)
+    call co_min(i,   1,              stat=status)
+    call co_min(i,   1,                           errmsg=message)
+    call co_min(i,   1,              stat=status, errmsg=message)
+    call co_min(i,   result_image=1, stat=status, errmsg=message)
+    call co_min(a=i, result_image=1, stat=status, errmsg=message)
+
+    call co_min(array,  result_image=1, stat=status, errmsg=message)
+    call co_min(vector, result_image=1, stat=status, errmsg=message)
+    call co_min(string, result_image=1, stat=status, errmsg=message)
+  
+    ! the error is seen as an incorrect type for the stat= argument
+    !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'
+    call co_min(i, 1, message)
+
+    ! the error is seen as too many arguments to the co_min() call
+    !ERROR: too many actual arguments for intrinsic 'co_min'
+    call co_min(i,   result_image=1, stat=status, errmsg=message, 3.4)
+  
+    ! keyword argument with incorrect type
+    !ERROR: unknown keyword argument to intrinsic 'co_min'
+    call co_min(fake=3.4)
+  
+  end subroutine
+
+end module test_co_min


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113077.384921.patch
Type: text/x-patch
Size: 1806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211105/5a33f988/attachment-0001.bin>


More information about the flang-commits mailing list