1! RUN: %python %S/test_errors.py %s %flang_fc1 2! This test checks for semantic errors in notify wait statements based on the 3! statement specification in section 11.6 of the Fortran 2023 standard. 4! Some of the errors in this test would be hidden by the errors in 5! the test notify02.f90 if they were included in that file, 6! and are thus tested here. 7 8program test_notify_wait 9 use iso_fortran_env, only : notify_type 10 implicit none 11 12 ! notify_type variables must be coarrays 13 type(notify_type) :: non_coarray 14 15 type(notify_type) :: notify_var[*], notify_array(2)[*] 16 integer :: count, count_array(1), non_notify[*], sync_status, coindexed_integer[*], superfluous_stat, non_scalar(1) 17 character(len=128) :: error_message, non_scalar_char(1), coindexed_character[*], superfluous_errmsg 18 logical :: invalid_type 19 20 !____________________ non-standard-conforming statements __________________________ 21 22 !_________________________ invalid notify-variable ________________________________ 23 24 !ERROR: The notify-variable must be of type NOTIFY_TYPE from module ISO_FORTRAN_ENV 25 notify wait(non_notify) 26 27 !ERROR: The notify-variable must be a coarray 28 notify wait(non_coarray) 29 30 !ERROR: A notify-variable in a NOTIFY WAIT statement may not be a coindexed object 31 notify wait(notify_var[1]) 32 33 !ERROR: A notify-variable in a NOTIFY WAIT statement may not be a coindexed object 34 notify wait(notify_array(1)[1]) 35 36 !ERROR: Must be a scalar value, but is a rank-1 array 37 notify wait(notify_array) 38 39 !_____________ invalid event-wait-spec-lists: invalid until-spec _________________ 40 41 !ERROR: Must have INTEGER type, but is LOGICAL(4) 42 notify wait(notify_var, until_count=invalid_type) 43 44 !ERROR: Must be a scalar value, but is a rank-1 array 45 notify wait(notify_var, until_count=non_scalar) 46 47 !_________________ invalid sync-stat-lists: invalid stat= ________________________ 48 49 !ERROR: Must have INTEGER type, but is LOGICAL(4) 50 notify wait(notify_var, stat=invalid_type) 51 52 !ERROR: Must be a scalar value, but is a rank-1 array 53 notify wait(notify_var, stat=non_scalar) 54 55 !________________ invalid sync-stat-lists: invalid errmsg= _______________________ 56 57 !ERROR: Must have CHARACTER type, but is LOGICAL(4) 58 notify wait(notify_var, errmsg=invalid_type) 59 60 !ERROR: Must be a scalar value, but is a rank-1 array 61 notify wait(notify_var, errmsg=non_scalar_char) 62 63 !______ invalid event-wait-spec-lists: redundant event-wait-spec-list ____________ 64 65 !ERROR: Until-spec in a event-wait-spec-list may not be repeated 66 notify wait(notify_var, until_count=count, until_count=count_array(1)) 67 68 !ERROR: Until-spec in a event-wait-spec-list may not be repeated 69 notify wait(notify_var, until_count=count, stat=sync_status, until_count=count_array(1)) 70 71 !ERROR: Until-spec in a event-wait-spec-list may not be repeated 72 notify wait(notify_var, until_count=count, errmsg=error_message, until_count=count_array(1)) 73 74 !ERROR: Until-spec in a event-wait-spec-list may not be repeated 75 notify wait(notify_var, until_count=count, stat=sync_status, errmsg=error_message, until_count=count_array(1)) 76 77 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated 78 notify wait(notify_var, stat=sync_status, stat=superfluous_stat) 79 80 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated 81 notify wait(notify_var, stat=sync_status, until_count=count, stat=superfluous_stat) 82 83 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated 84 notify wait(notify_var, stat=sync_status, errmsg=error_message, stat=superfluous_stat) 85 86 !ERROR: A stat-variable in a event-wait-spec-list may not be repeated 87 notify wait(notify_var, stat=sync_status, until_count=count, errmsg=error_message, stat=superfluous_stat) 88 89 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated 90 notify wait(notify_var, errmsg=error_message, errmsg=superfluous_errmsg) 91 92 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated 93 notify wait(notify_var, errmsg=error_message, until_count=count, errmsg=superfluous_errmsg) 94 95 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated 96 notify wait(notify_var, errmsg=error_message, stat=superfluous_stat, errmsg=superfluous_errmsg) 97 98 !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated 99 notify wait(notify_var, errmsg=error_message, until_count=count, stat=superfluous_stat, errmsg=superfluous_errmsg) 100 101 !_____________ invalid sync-stat-lists: coindexed stat-variable - C1173 __________________ 102 103 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 104 notify wait(notify_var, stat=coindexed_integer[1]) 105 106 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 107 notify wait(notify_var, errmsg=coindexed_character[1]) 108 109 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 110 notify wait(notify_var, stat=coindexed_integer[1], errmsg=error_message) 111 112 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 113 notify wait(notify_var, stat=sync_status, errmsg=coindexed_character[1]) 114 115 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 116 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 117 notify wait(notify_var, stat=coindexed_integer[1], errmsg=coindexed_character[1]) 118 119 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 120 !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object 121 notify wait(notify_var, errmsg=coindexed_character[1], stat=coindexed_integer[1]) 122 123end program test_notify_wait 124