xref: /llvm-project/flang/test/Semantics/notifywait02.f90 (revision a2d7af757bc33dc91f2e038742915a146cfb0c13)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! This test checks for semantic errors in notify wait statements based on the
3! statement specification in section 11.6 of the Fortran 2023 standard
4
5program test_notify_wait
6  use iso_fortran_env, only: notify_type
7  implicit none
8
9  ! notify_type variables must be coarrays
10  type(notify_type) :: non_coarray
11
12  type(notify_type) :: notify_var[*], redundant_notify[*]
13  integer :: count, sync_status
14  character(len=128) :: error_message
15
16  !____________________ non-standard-conforming statements __________________________
17
18  !_________________________ invalid notify-variable ________________________________
19
20  ! notify-variable has an unknown expression
21  !ERROR: expected '('
22  notify wait(notify=notify_var)
23
24  !_____________ invalid event-wait-spec-lists: invalid until-spec _________________
25
26  ! Invalid until-spec keyword
27  !ERROR: expected '('
28  notify wait(notify_var, until_amount=count)
29
30  ! Invalid until-spec: missing until-spec variable
31  !ERROR: expected '('
32  notify wait(notify_var, until_count)
33
34  ! Invalid until-spec: missing 'until_count='
35  !ERROR: expected '('
36  notify wait(notify_var, count)
37
38  !_________________ invalid sync-stat-lists: invalid stat= ________________________
39
40  ! Invalid stat-variable keyword
41  !ERROR: expected '('
42  notify wait(notify_var, status=sync_status)
43
44  ! Invalid sync-stat-list: missing stat-variable
45  !ERROR: expected '('
46  notify wait(notify_var, stat)
47
48  ! Invalid sync-stat-list: missing 'stat='
49  !ERROR: expected '('
50  notify wait(notify_var, sync_status)
51
52  !________________ invalid sync-stat-lists: invalid errmsg= _______________________
53
54  ! Invalid errmsg-variable keyword
55  !ERROR: expected '('
56  notify wait(notify_var, errormsg=error_message)
57
58  ! Invalid sync-stat-list: missing 'errmsg='
59  !ERROR: expected '('
60  notify wait(notify_var, error_message)
61
62  ! Invalid sync-stat-list: missing errmsg-variable
63  !ERROR: expected '('
64  notify wait(notify_var, errmsg)
65
66  !______________ invalid notify-variable: redundant notify-variable _________________
67
68  !ERROR: expected '('
69  notify wait(notify_var, redundant_notify)
70
71  !ERROR: expected '('
72  notify wait(notify_var, redundant_notify, stat=sync_status, errmsg=error_message)
73
74end program test_notify_wait
75