xref: /llvm-project/flang/test/Semantics/synchronization04b.f90 (revision f770b1e9544967ce31b3c7eea3cfa87c00936ad2)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! This test checks for semantic errors in sync team statements.
3! Some of the errors in this test would be hidden by the errors in
4! the test synchronization04a.f90 if they were included in that file,
5! and are thus tested here.
6
7program test_sync_team
8  use iso_fortran_env, only : team_type
9  implicit none
10
11  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1), not_a_team
12  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
13  logical invalid_type
14  type(team_type) warriors
15
16  !___ non-standard-conforming statements ___
17
18  !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV
19  sync team(not_a_team)
20
21  !ERROR: Must have INTEGER type, but is LOGICAL(4)
22  sync team(warriors, stat=invalid_type)
23
24  !ERROR: Must be a scalar value, but is a rank-1 array
25  sync team(warriors, stat=non_scalar)
26
27  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
28  sync team(warriors, errmsg=invalid_type)
29
30  !ERROR: The stat-variable in a sync-stat-list may not be repeated
31  sync team(warriors, stat=sync_status, stat=superfluous_stat)
32
33  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
34  sync team(warriors, errmsg=error_message, errmsg=superfluous_errmsg)
35
36  !ERROR: The stat-variable in a sync-stat-list may not be repeated
37  sync team(warriors, stat=sync_status, errmsg=error_message, stat=superfluous_stat)
38
39  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
40  sync team(warriors, stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg)
41
42  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
43  sync team(warriors, stat=co_indexed_integer[1])
44
45  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
46  sync team(warriors, errmsg=co_indexed_character[1])
47
48end program test_sync_team
49