1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! This test checks for semantic errors in event wait statements based on the
3 ! statement specification in section 11.6.8 of the Fortran 2018 standard.
5 program test_event_wait
6 use iso_fortran_env
, only
: event_type
9 ! event_type variables must be coarrays
10 type(event_type
) non_coarray
12 type(event_type
) concert
[*], occurrences(2)[*]
13 integer threshold
, indexed(1), non_event
[*], sync_status
, co_indexed_integer
[*], superfluous_stat
, non_scalar(1)
14 character(len
=128) error_message
, non_scalar_char(1), co_indexed_character
[*], superfluous_errmsg
17 !_______________________ standard-conforming statements ___________________________
20 event
wait(occurrences(1))
21 event
wait(concert
, until_count
=threshold
)
22 event
wait(concert
, until_count
=indexed(1))
23 event
wait(concert
, until_count
=co_indexed_integer
[1])
24 event
wait(concert
, stat
=sync_status
)
25 event
wait(concert
, until_count
=threshold
, stat
=sync_status
)
26 event
wait(concert
, errmsg
=error_message
)
27 event
wait(concert
, until_count
=threshold
, errmsg
=error_message
)
28 event
wait(concert
, stat
=sync_status
, errmsg
=error_message
)
29 event
wait(concert
, until_count
=threshold
, stat
=sync_status
, errmsg
=error_message
)
31 !____________________ non-standard-conforming statements __________________________
33 !_________________________ invalid event-variable ________________________________
35 ! event-variable has an unknown expression
37 event
wait(event
=concert
)
39 !_____________ invalid event-wait-spec-lists: invalid until-spec _________________
41 ! Invalid until-spec keyword
43 event
wait(concert
, until_amount
=threshold
)
45 ! Invalid until-spec: missing until-spec variable
47 event
wait(concert
, until_count
)
49 ! Invalid until-spec: missing 'until_count='
51 event
wait(concert
, threshold
)
53 !_________________ invalid sync-stat-lists: invalid stat= ________________________
55 ! Invalid stat-variable keyword
57 event
wait(concert
, status
=sync_status
)
59 ! Invalid sync-stat-list: missing stat-variable
61 event
wait(concert
, stat
)
63 ! Invalid sync-stat-list: missing 'stat='
65 event
wait(concert
, sync_status
)
67 !________________ invalid sync-stat-lists: invalid errmsg= _______________________
69 ! Invalid errmsg-variable keyword
71 event
wait(concert
, errormsg
=error_message
)
73 ! Invalid sync-stat-list: missing 'errmsg='
75 event
wait(concert
, error_message
)
77 ! Invalid sync-stat-list: missing errmsg-variable
79 event
wait(concert
, errmsg
)
81 !______________ invalid event-variable: redundant event-variable _________________
84 event
wait(concert
, occurrences(1))
87 event
wait(concert
, occurrences(1), stat
=sync_status
, errmsg
=error_message
)
89 end program test_event_wait