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