11! RUN: %python %S/test_errors.py %s %flang_fc1
2- ! XFAIL: *
32! This test checks for semantic errors in event_query() subroutine based on the
43! statement specification in section 16.9.72 of the Fortran 2018 standard.
54
65program test_event_query
76 use iso_fortran_env, only : event_type
8- implicit none
9-
10- ! event_type variables must be coarrays
11- type (event_type) non_coarray
7+ implicit none (type,external )
128
139 type (event_type) concert[* ], occurrences(2 )[* ]
1410 integer non_event[* ], counter, array(1 ), coarray[* ], sync_status, coindexed[* ], non_scalar(1 )
@@ -33,70 +29,90 @@ program test_event_query
3329 ! ___ non-standard-conforming calls _______
3430
3531 ! event-variable must be event_type
32+ ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'
3633 call event_query(non_event, counter)
3734
38- ! event-variable must be a coarray
39- call event_query(non_coarray, counter)
40-
4135 ! event-variable must be a scalar variable
36+ ! ERROR: 'event=' argument has unacceptable rank 1
4237 call event_query(occurrences, counter)
4338
4439 ! event-variable must not be coindexed
40+ ! ERROR: EVENT= argument to EVENT_QUERY must not be coindexed
4541 call event_query(concert[1 ], counter)
4642
4743 ! event-variable has an unknown keyword argument
44+ ! ERROR: unknown keyword argument to intrinsic 'event_query'
4845 call event_query(events= concert, count= counter)
4946
5047 ! event-variable has an argument mismatch
48+ ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'
5149 call event_query(event= non_event, count= counter)
5250
5351 ! count must be an integer
52+ ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'
5453 call event_query(concert, non_integer)
5554
5655 ! count must be an integer scalar
56+ ! ERROR: 'count=' argument has unacceptable rank 1
5757 call event_query(concert, non_scalar)
5858
5959 ! count must be have a decimal exponent range
6060 ! no smaller than that of default integer
61+ ! ERROR: COUNT= argument to EVENT_QUERY must be an integer with kind >= 4
6162 call event_query(concert, non_default)
6263
6364 ! count is an intent(out) argument
65+ ! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'count=' is not definable
66+ ! ERROR: '4_4' is not a variable or pointer
6467 call event_query(concert, 4 )
6568
6669 ! count has an unknown keyword argument
70+ ! ERROR: unknown keyword argument to intrinsic 'event_query'
6771 call event_query(concert, counts= counter)
6872
6973 ! count has an argument mismatch
74+ ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'
7075 call event_query(concert, count= non_integer)
7176
7277 ! stat must be an integer
78+ ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
7379 call event_query(concert, counter, non_integer)
7480
7581 ! stat must be an integer scalar
82+ ! ERROR: 'stat=' argument has unacceptable rank 1
7683 call event_query(concert, counter, non_scalar)
7784
7885 ! stat is an intent(out) argument
86+ ! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' is not definable
87+ ! ERROR: '8_4' is not a variable or pointer
7988 call event_query(concert, counter, 8 )
8089
8190 ! stat has an unknown keyword argument
91+ ! ERROR: unknown keyword argument to intrinsic 'event_query'
8292 call event_query(concert, counter, status= sync_status)
8393
8494 ! stat has an argument mismatch
95+ ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
8596 call event_query(concert, counter, stat= non_integer)
8697
8798 ! stat must not be coindexed
99+ ! ERROR: 'stat' argument to 'event_query' may not be a coindexed object
88100 call event_query(concert, counter, coindexed[1 ])
89101
90102 ! Too many arguments
103+ ! ERROR: too many actual arguments for intrinsic 'event_query'
91104 call event_query(concert, counter, sync_status, array(1 ))
92105
93106 ! Repeated event keyword
107+ ! ERROR: repeated keyword argument to intrinsic 'event_query'
94108 call event_query(event= concert, event= occurrences(1 ), count= counter)
95109
96110 ! Repeated count keyword
111+ ! ERROR: repeated keyword argument to intrinsic 'event_query'
97112 call event_query(event= concert, count= counter, count= array(1 ))
98113
99114 ! Repeated stat keyword
115+ ! ERROR: repeated keyword argument to intrinsic 'event_query'
100116 call event_query(event= concert, count= counter, stat= sync_status, stat= array(1 ))
101117
102118end program test_event_query
0 commit comments