119 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in event_query() subroutine based on the3! statement specification in section 16.9.72 of the Fortran 2018 standard.4 5program test_event_query6 use iso_fortran_env, only : event_type7 implicit none(type,external)8 9 type(event_type) concert[*], occurrences(2)[*]10 integer non_event[*], counter, array(1), coarray[*], sync_status, coindexed[*], non_scalar(1)11 integer(kind=1) non_default12 logical non_integer13 14 !___ standard-conforming calls with required arguments _______15 16 call event_query(concert, counter)17 call event_query(occurrences(1), counter)18 call event_query(concert, array(1))19 call event_query(concert, coarray[1])20 call event_query(event=concert, count=counter)21 call event_query(count=counter, event=concert)22 23 !___ standard-conforming calls with all arguments ____________24 call event_query(concert, counter, sync_status)25 call event_query(concert, counter, array(1))26 call event_query(event=concert, count=counter, stat=sync_status)27 call event_query(stat=sync_status, count=counter, event=concert)28 29 !___ non-standard-conforming calls _______30 31 ! event-variable must be event_type32 ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'33 call event_query(non_event, counter)34 35 ! event-variable must be a scalar variable36 ! ERROR: 'event=' argument has unacceptable rank 137 call event_query(occurrences, counter)38 39 ! event-variable must not be coindexed40 ! ERROR: EVENT= argument to EVENT_QUERY must not be coindexed41 call event_query(concert[1], counter)42 43 ! event-variable has an unknown keyword argument44 ! ERROR: unknown keyword argument to intrinsic 'event_query'45 call event_query(events=concert, count=counter)46 47 ! event-variable has an argument mismatch48 ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'49 call event_query(event=non_event, count=counter)50 51 ! count must be an integer52 ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'53 call event_query(concert, non_integer)54 55 ! count must be an integer scalar56 ! ERROR: 'count=' argument has unacceptable rank 157 call event_query(concert, non_scalar)58 59 ! count must be have a decimal exponent range60 ! no smaller than that of default integer61 ! ERROR: COUNT= argument to EVENT_QUERY must be an integer with kind >= 462 call event_query(concert, non_default)63 64 ! count is an intent(out) argument65 ! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'count=' is not definable66 ! ERROR: '4_4' is not a variable or pointer67 call event_query(concert, 4)68 69 ! count has an unknown keyword argument70 ! ERROR: unknown keyword argument to intrinsic 'event_query'71 call event_query(concert, counts=counter)72 73 ! count has an argument mismatch74 ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'75 call event_query(concert, count=non_integer)76 77 ! stat must be an integer78 ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'79 call event_query(concert, counter, non_integer)80 81 ! stat must be an integer scalar82 ! ERROR: 'stat=' argument has unacceptable rank 183 call event_query(concert, counter, non_scalar)84 85 ! stat is an intent(out) argument86 ! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' is not definable87 ! ERROR: '8_4' is not a variable or pointer88 call event_query(concert, counter, 8)89 90 ! stat has an unknown keyword argument91 ! ERROR: unknown keyword argument to intrinsic 'event_query'92 call event_query(concert, counter, status=sync_status)93 94 ! stat has an argument mismatch95 ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'96 call event_query(concert, counter, stat=non_integer)97 98 ! stat must not be coindexed99 ! ERROR: 'stat' argument to 'event_query' may not be a coindexed object100 call event_query(concert, counter, coindexed[1])101 102 ! Too many arguments103 ! ERROR: too many actual arguments for intrinsic 'event_query'104 call event_query(concert, counter, sync_status, array(1))105 106 ! Repeated event keyword107 ! ERROR: repeated keyword argument to intrinsic 'event_query'108 call event_query(event=concert, event=occurrences(1), count=counter)109 110 ! Repeated count keyword111 ! ERROR: repeated keyword argument to intrinsic 'event_query'112 call event_query(event=concert, count=counter, count=array(1))113 114 ! Repeated stat keyword115 ! ERROR: repeated keyword argument to intrinsic 'event_query'116 call event_query(event=concert, count=counter, stat=sync_status, stat=array(1))117 118end program test_event_query119