Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / event_query.f90
blob3f38e3dd378778daa5b78cb536160d384ca3c265
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! XFAIL: *
3 ! This test checks for semantic errors in event_query() subroutine based on the
4 ! statement specification in section 16.9.72 of the Fortran 2018 standard.
6 program test_event_query
7 use iso_fortran_env, only : event_type
8 implicit none
10 ! event_type variables must be coarrays
11 type(event_type) non_coarray
13 type(event_type) concert[*], occurrences(2)[*]
14 integer non_event[*], counter, array(1), coarray[*], sync_status, coindexed[*], non_scalar(1)
15 integer(kind=1) non_default
16 logical non_integer
18 !___ standard-conforming calls with required arguments _______
20 call event_query(concert, counter)
21 call event_query(occurrences(1), counter)
22 call event_query(concert, array(1))
23 call event_query(concert, coarray[1])
24 call event_query(event=concert, count=counter)
25 call event_query(count=counter, event=concert)
27 !___ standard-conforming calls with all arguments ____________
28 call event_query(concert, counter, sync_status)
29 call event_query(concert, counter, array(1))
30 call event_query(event=concert, count=counter, stat=sync_status)
31 call event_query(stat=sync_status, count=counter, event=concert)
33 !___ non-standard-conforming calls _______
35 ! event-variable must be event_type
36 call event_query(non_event, counter)
38 ! event-variable must be a coarray
39 call event_query(non_coarray, counter)
41 ! event-variable must be a scalar variable
42 call event_query(occurrences, counter)
44 ! event-variable must not be coindexed
45 call event_query(concert[1], counter)
47 ! event-variable has an unknown keyword argument
48 call event_query(events=concert, count=counter)
50 ! event-variable has an argument mismatch
51 call event_query(event=non_event, count=counter)
53 ! count must be an integer
54 call event_query(concert, non_integer)
56 ! count must be an integer scalar
57 call event_query(concert, non_scalar)
59 ! count must be have a decimal exponent range
60 ! no smaller than that of default integer
61 call event_query(concert, non_default)
63 ! count is an intent(out) argument
64 call event_query(concert, 4)
66 ! count has an unknown keyword argument
67 call event_query(concert, counts=counter)
69 ! count has an argument mismatch
70 call event_query(concert, count=non_integer)
72 ! stat must be an integer
73 call event_query(concert, counter, non_integer)
75 ! stat must be an integer scalar
76 call event_query(concert, counter, non_scalar)
78 ! stat is an intent(out) argument
79 call event_query(concert, counter, 8)
81 ! stat has an unknown keyword argument
82 call event_query(concert, counter, status=sync_status)
84 ! stat has an argument mismatch
85 call event_query(concert, counter, stat=non_integer)
87 ! stat must not be coindexed
88 call event_query(concert, counter, coindexed[1])
90 ! Too many arguments
91 call event_query(concert, counter, sync_status, array(1))
93 ! Repeated event keyword
94 call event_query(event=concert, event=occurrences(1), count=counter)
96 ! Repeated count keyword
97 call event_query(event=concert, count=counter, count=array(1))
99 ! Repeated stat keyword
100 call event_query(event=concert, count=counter, stat=sync_status, stat=array(1))
102 end program test_event_query