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 ! Some of the errors in this test would be hidden by the errors in
5 ! the test event01a.f90 if they were included in that file,
6 ! and are thus tested here.
8 program test_event_post
9 use iso_fortran_env
, only
: event_type
12 ! event_type variables must be coarrays
13 type(event_type
) non_coarray
15 type(event_type
) concert
[*], occurrences(2)[*]
16 integer non_event
[*], sync_status
, co_indexed_integer
[*], superfluous_stat
, non_scalar(1)
17 character(len
=128) error_message
, co_indexed_character
[*], superfluous_errmsg
20 !___ non-standard-conforming statements ___
22 !______ invalid event-variable ____________________________
24 ! event-variable must be event_type
25 !ERROR: The event-variable must be of type EVENT_TYPE from module ISO_FORTRAN_ENV
28 ! event-variable must be a coarray
29 !ERROR: The event-variable must be a coarray
30 event
post(non_coarray
)
32 !ERROR: Must be a scalar value, but is a rank-1 array
33 event
post(occurrences
)
35 !ERROR: Must be a scalar value, but is a rank-1 array
36 event
post(occurrences
[1])
38 !______ invalid sync-stat-lists: invalid stat= ____________
40 !ERROR: Must have INTEGER type, but is LOGICAL(4)
41 event
post(concert
, stat
=invalid_type
)
43 !ERROR: Must be a scalar value, but is a rank-1 array
44 event
post(concert
, stat
=non_scalar
)
46 !______ invalid sync-stat-lists: invalid errmsg= ____________
48 !ERROR: Must have CHARACTER type, but is LOGICAL(4)
49 event
post(concert
, errmsg
=invalid_type
)
51 !______ invalid sync-stat-lists: redundant sync-stat-list ____________
53 !ERROR: The stat-variable in a sync-stat-list may not be repeated
54 event
post(concert
, stat
=sync_status
, stat
=superfluous_stat
)
56 !ERROR: The stat-variable in a sync-stat-list may not be repeated
57 event
post(concert
, errmsg
=error_message
, stat
=sync_status
, stat
=superfluous_stat
)
59 !ERROR: The stat-variable in a sync-stat-list may not be repeated
60 event
post(concert
, stat
=sync_status
, errmsg
=error_message
, stat
=superfluous_stat
)
62 !ERROR: The stat-variable in a sync-stat-list may not be repeated
63 event
post(concert
, stat
=sync_status
, stat
=superfluous_stat
, errmsg
=error_message
)
65 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
66 event
post(concert
, errmsg
=error_message
, errmsg
=superfluous_errmsg
)
68 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
69 event
post(concert
, stat
=sync_status
, errmsg
=error_message
, errmsg
=superfluous_errmsg
)
71 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
72 event
post(concert
, errmsg
=error_message
, stat
=sync_status
, errmsg
=superfluous_errmsg
)
74 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
75 event
post(concert
, errmsg
=error_message
, errmsg
=superfluous_errmsg
, stat
=sync_status
)
77 !______ invalid sync-stat-lists: coindexed stat-variable - C1173____________
79 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
80 event
post(concert
, stat
=co_indexed_integer
[1])
82 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
83 event
post(concert
, errmsg
=co_indexed_character
[1])
85 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
86 event
post(concert
, stat
=co_indexed_integer
[1], errmsg
=error_message
)
88 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
89 event
post(concert
, stat
=sync_status
, errmsg
=co_indexed_character
[1])
91 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
92 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
93 event
post(concert
, stat
=co_indexed_integer
[1], errmsg
=co_indexed_character
[1])
95 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
96 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
97 event
post(concert
, errmsg
=co_indexed_character
[1], stat
=co_indexed_integer
[1])
99 end program test_event_post