Index: flang/test/Semantics/collectives03.f90 =================================================================== --- /dev/null +++ flang/test/Semantics/collectives03.f90 @@ -0,0 +1,45 @@ +! RUN: %S/test_errors.sh %s %t %flang_fc1 +! REQUIRES: shell +! Check for semantic errors in co_max() function calls + +module test_co_max + 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_max(i) + call co_max(i, 1) + call co_max(i, 1, status) + call co_max(i, 1, stat=status) + call co_max(i, 1, errmsg=message) + call co_max(i, 1, stat=status, errmsg=message) + call co_max(i, result_image=1, stat=status, errmsg=message) + call co_max(a=i, result_image=1, stat=status, errmsg=message) + + call co_max(array, result_image=1, stat=status, errmsg=message) + call co_max(vector, result_image=1, stat=status, errmsg=message) + call co_max(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_max(i, 1, message) + + ! the error is seen as too many arguments to the co_max() call + !ERROR: too many actual arguments for collective subroutines 'co_max' + call co_max(i, result_image=1, stat=status, errmsg=message, 3.4) + + ! keyword argument with incorrect type + !ERROR: unknown keyword argument to intrinsic 'co_max' + call co_max(fake=3.4) + + end subroutine + +end module test_co_max