[flang-commits] [flang] 06683d5 - [flang] Add semantics test for `get_team`
Katherine Rasmussen via flang-commits
flang-commits at lists.llvm.org
Thu Jun 30 11:08:27 PDT 2022
Author: Katherine Rasmussen
Date: 2022-06-30T10:54:05-07:00
New Revision: 06683d5f74f7551f4f36161fa3657146b1091311
URL: https://github.com/llvm/llvm-project/commit/06683d5f74f7551f4f36161fa3657146b1091311
DIFF: https://github.com/llvm/llvm-project/commit/06683d5f74f7551f4f36161fa3657146b1091311.diff
LOG: [flang] Add semantics test for `get_team`
Add a semantics test for the intrinsic function `get_team`.
Differential Revision: https://reviews.llvm.org/D128370
Added:
flang/test/Semantics/get_team.f90
Modified:
Removed:
################################################################################
diff --git a/flang/test/Semantics/get_team.f90 b/flang/test/Semantics/get_team.f90
new file mode 100644
index 0000000000000..a28b0d72f23ff
--- /dev/null
+++ b/flang/test/Semantics/get_team.f90
@@ -0,0 +1,55 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Check for semantic errors in get_team(), as defined in
+! section 16.9.85 of the Fortran 2018 standard
+
+program get_team_test
+ use iso_fortran_env, only: team_type, initial_team, current_team, parent_team
+ implicit none
+
+ integer n, array(1), coarray[*]
+ type(team_type) :: result_team
+ logical wrong_result_type, non_integer
+
+ !___ standard-conforming statement with no optional arguments present ___
+ result_team = get_team()
+
+ !___ standard-conforming statements with optional level argument present ___
+ result_team = get_team(-1)
+ result_team = get_team(-2)
+ result_team = get_team(-3)
+ result_team = get_team(initial_team)
+ result_team = get_team(current_team)
+ result_team = get_team(parent_team)
+ result_team = get_team(n)
+ result_team = get_team(array(1))
+ result_team = get_team(array(n))
+ result_team = get_team(coarray[1])
+ result_team = get_team(level=initial_team)
+ result_team = get_team(level=n)
+
+ !___ non-conforming statements ___
+ !ERROR: 'level=' argument has unacceptable rank 1
+ result_team = get_team(array)
+
+ !ERROR: Actual argument for 'level=' has bad type 'LOGICAL(4)'
+ result_team = get_team(non_integer)
+
+ !ERROR: Actual argument for 'level=' has bad type 'REAL(4)'
+ result_team = get_team(3.4)
+
+ !ERROR: too many actual arguments for intrinsic 'get_team'
+ result_team = get_team(current_team, parent_team)
+
+ !ERROR: Actual argument for 'level=' has bad type 'REAL(4)'
+ result_team = get_team(level=3.4)
+
+ !ERROR: unknown keyword argument to intrinsic 'get_team'
+ result_team = get_team(levels=initial_team)
+
+ !ERROR: repeated keyword argument to intrinsic 'get_team'
+ result_team = get_team(level=initial_team, level=parent_team)
+
+ !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and TYPE(__builtin_team_type)
+ wrong_result_type = get_team()
+
+end program get_team_test
More information about the flang-commits
mailing list