136 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in event wait statements based on the3! statement specification in section 11.6.8 of the Fortran 2018 standard.4! Some of the errors in this test would be hidden by the errors in5! the test event02a.f90 if they were included in that file,6! and are thus tested here.7 8program test_event_wait9 use iso_fortran_env, only : event_type10 implicit none11 12 ! event_type variables must be coarrays13 !ERROR: Variable 'non_coarray' with EVENT_TYPE or LOCK_TYPE must be a coarray14 type(event_type) non_coarray15 16 type(event_type) concert[*], occurrences(2)[*]17 integer threshold, indexed(1), non_event[*], sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)18 character(len=128) error_message, non_scalar_char(1), co_indexed_character[*], superfluous_errmsg19 logical invalid_type20 21 type t22 type(event_type) event23 end type24 !ERROR: Entity 'badfunc0' with EVENT_TYPE or LOCK_TYPE must be an object25 procedure(type(event_type)) :: badfunc026 !ERROR: Entity 'badfunc1' with EVENT_TYPE or LOCK_TYPE must be an object27 procedure(type(event_type)), pointer :: badfunc128 !ERROR: Entity 'badfunc2' with EVENT_TYPE or LOCK_TYPE potential subobject component '%event' must be an object29 procedure(type(t)) badfunc230 !ERROR: Entity 'badfunc3' with EVENT_TYPE or LOCK_TYPE must be an object31 type(event_type), external :: badfunc332 !ERROR: Entity 'badfunc4' with EVENT_TYPE or LOCK_TYPE potential subobject component '%event' must be an object33 type(t), external :: badfunc434 35 !____________________ non-standard-conforming statements __________________________36 37 !_________________________ invalid event-variable ________________________________38 39 !ERROR: The event-variable must be of type EVENT_TYPE from module ISO_FORTRAN_ENV40 event wait(non_event)41 42 !ERROR: A event-variable in a EVENT WAIT statement may not be a coindexed object43 event wait(concert[1])44 45 !ERROR: A event-variable in a EVENT WAIT statement may not be a coindexed object46 event wait(occurrences(1)[1])47 48 !ERROR: Must be a scalar value, but is a rank-1 array49 event wait(occurrences)50 51 !_____________ invalid event-wait-spec-lists: invalid until-spec _________________52 53 !ERROR: Must have INTEGER type, but is LOGICAL(4)54 event wait(concert, until_count=invalid_type)55 56 !ERROR: Must be a scalar value, but is a rank-1 array57 event wait(concert, until_count=non_scalar)58 59 !_________________ invalid sync-stat-lists: invalid stat= ________________________60 61 !ERROR: Must have INTEGER type, but is LOGICAL(4)62 event wait(concert, stat=invalid_type)63 64 !ERROR: Must be a scalar value, but is a rank-1 array65 event wait(concert, stat=non_scalar)66 67 !________________ invalid sync-stat-lists: invalid errmsg= _______________________68 69 !ERROR: Must have CHARACTER type, but is LOGICAL(4)70 event wait(concert, errmsg=invalid_type)71 72 !ERROR: Must be a scalar value, but is a rank-1 array73 event wait(concert, errmsg=non_scalar_char)74 75 !______ invalid event-wait-spec-lists: redundant event-wait-spec-list ____________76 77 !ERROR: Until-spec in a event-wait-spec-list may not be repeated78 event wait(concert, until_count=threshold, until_count=indexed(1))79 80 !ERROR: Until-spec in a event-wait-spec-list may not be repeated81 event wait(concert, until_count=threshold, stat=sync_status, until_count=indexed(1))82 83 !ERROR: Until-spec in a event-wait-spec-list may not be repeated84 event wait(concert, until_count=threshold, errmsg=error_message, until_count=indexed(1))85 86 !ERROR: Until-spec in a event-wait-spec-list may not be repeated87 event wait(concert, until_count=threshold, stat=sync_status, errmsg=error_message, until_count=indexed(1))88 89 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated90 event wait(concert, stat=sync_status, stat=superfluous_stat)91 92 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated93 event wait(concert, stat=sync_status, until_count=threshold, stat=superfluous_stat)94 95 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated96 event wait(concert, stat=sync_status, errmsg=error_message, stat=superfluous_stat)97 98 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated99 event wait(concert, stat=sync_status, until_count=threshold, errmsg=error_message, stat=superfluous_stat)100 101 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated102 event wait(concert, errmsg=error_message, errmsg=superfluous_errmsg)103 104 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated105 event wait(concert, errmsg=error_message, until_count=threshold, errmsg=superfluous_errmsg)106 107 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated108 event wait(concert, errmsg=error_message, stat=superfluous_stat, errmsg=superfluous_errmsg)109 110 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated111 event wait(concert, errmsg=error_message, until_count=threshold, stat=superfluous_stat, errmsg=superfluous_errmsg)112 113 !_____________ invalid sync-stat-lists: coindexed stat-variable - C1173 __________________114 115 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object116 event wait(concert, stat=co_indexed_integer[1])117 118 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object119 event wait(concert, errmsg=co_indexed_character[1])120 121 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object122 event wait(concert, stat=co_indexed_integer[1], errmsg=error_message)123 124 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object125 event wait(concert, stat=sync_status, errmsg=co_indexed_character[1])126 127 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object128 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object129 event wait(concert, stat=co_indexed_integer[1], errmsg=co_indexed_character[1])130 131 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object132 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object133 event wait(concert, errmsg=co_indexed_character[1], stat=co_indexed_integer[1])134 135end program test_event_wait136