xref: /llvm-project/flang/test/Semantics/event01a.f90 (revision 21dceb3ca67cdc0e05b95e1d229bd01a8cd29f60)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! This test checks for semantic errors in event post statements based on the
3! statement specification in section 11.6.7 of the Fortran 2018 standard.
4
5program test_event_post
6  use iso_fortran_env, only : event_type
7  implicit none
8
9  ! event_type variables must be coarrays
10  type(event_type) non_coarray
11
12  type(event_type) concert[*], occurrences(2)[*]
13  integer non_event[*], sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
14  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
15  logical invalid_type
16
17  !___ standard-conforming statements ___
18
19  event post(concert)
20  event post(concert[1])
21  event post(occurrences(1))
22  event post(occurrences(1)[1])
23  event post(concert, stat=sync_status)
24  event post(concert,                   errmsg=error_message)
25  event post(concert, stat=sync_status, errmsg=error_message)
26
27  !___ non-standard-conforming statements ___
28
29  !______ invalid event-variable ____________________________
30
31  ! event-variable has an unknown keyword argument
32  !ERROR: expected ')'
33  event post(event=concert)
34
35  !______ invalid sync-stat-lists: invalid stat= ____________
36
37  ! Invalid stat-variable keyword
38  !ERROR: expected ')'
39  event post(concert, status=sync_status)
40
41  ! Invalid sync-stat-list: missing stat-variable
42  !ERROR: expected ')'
43  event post(concert, stat)
44
45  ! Invalid sync-stat-list: missing 'stat='
46  !ERROR: expected ')'
47  event post(concert, sync_status)
48
49  !______ invalid sync-stat-lists: invalid errmsg= ____________
50
51  ! Invalid errmsg-variable keyword
52  !ERROR: expected ')'
53  event post(concert, errormsg=error_message)
54
55  ! Invalid sync-stat-list: missing 'errmsg='
56  !ERROR: expected ')'
57  event post(concert, error_message)
58
59  ! Invalid sync-stat-list: missing errmsg-variable
60  !ERROR: expected ')'
61  event post(concert, errmsg)
62
63  !______ invalid event-variable: redundant event-variable ____________
64
65  ! Too many arguments
66  !ERROR: expected ')'
67  event post(concert, occurrences(1))
68
69  ! Too many arguments
70  !ERROR: expected ')'
71  event post(concert, occurrences(1), stat=sync_status, errmsg=error_message)
72
73end program test_event_post
74