Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / event01b.f90
blob7cf374fbcc84e96c1e5f41b8dc491bdbefe1d1e7
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
10 implicit none
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
18 logical invalid_type
20 !___ non-standard-conforming statements ___
22 !______ invalid event-variable ____________________________
24 ! event-variable must be event_type
25 event post(non_event)
27 ! event-variable must be a coarray
28 event post(non_coarray)
30 !ERROR: Must be a scalar value, but is a rank-1 array
31 event post(occurrences)
33 !ERROR: Must be a scalar value, but is a rank-1 array
34 event post(occurrences[1])
36 !______ invalid sync-stat-lists: invalid stat= ____________
38 !ERROR: Must have INTEGER type, but is LOGICAL(4)
39 event post(concert, stat=invalid_type)
41 !ERROR: Must be a scalar value, but is a rank-1 array
42 event post(concert, stat=non_scalar)
44 !______ invalid sync-stat-lists: invalid errmsg= ____________
46 !ERROR: Must have CHARACTER type, but is LOGICAL(4)
47 event post(concert, errmsg=invalid_type)
49 !______ invalid sync-stat-lists: redundant sync-stat-list ____________
51 ! No specifier shall appear more than once in a given sync-stat-list
52 event post(concert, stat=sync_status, stat=superfluous_stat)
54 ! No specifier shall appear more than once in a given sync-stat-list
55 event post(concert, errmsg=error_message, errmsg=superfluous_errmsg)
57 !______ invalid sync-stat-lists: coindexed stat-variable ____________
59 ! Check constraint C1173 from the Fortran 2018 standard
60 event post(concert, stat=co_indexed_integer[1])
62 ! Check constraint C1173 from the Fortran 2018 standard
63 event post(concert, errmsg=co_indexed_character[1])
65 end program test_event_post