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