brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · a336a7a Raw
125 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in notify wait statements based on the3! 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 in5! the test notify02.f90 if they were included in that file,6! and are thus tested here.7 8program test_notify_wait9  use iso_fortran_env, only : notify_type10  implicit none11 12  ! notify_type variables must be coarrays13  !ERROR: Variable 'non_coarray' with NOTIFY_TYPE must be a coarray14  type(notify_type) :: non_coarray15 16  type(notify_type) :: notify_var[*], notify_array(2)[*]17  integer :: count, count_array(1), non_notify[*], sync_status, coindexed_integer[*], superfluous_stat, non_scalar(1)18  character(len=128) :: error_message, non_scalar_char(1), coindexed_character[*], superfluous_errmsg19  logical :: invalid_type20 21  !____________________ non-standard-conforming statements __________________________22 23  !_________________________ invalid notify-variable ________________________________24 25  !ERROR: The notify-variable must be of type NOTIFY_TYPE from module ISO_FORTRAN_ENV26  notify wait(non_notify)27 28  !ERROR: The notify-variable must be a coarray29  notify wait(non_coarray)30 31  !ERROR: A notify-variable in a NOTIFY WAIT statement may not be a coindexed object32  notify wait(notify_var[1])33 34  !ERROR: A notify-variable in a NOTIFY WAIT statement may not be a coindexed object35  notify wait(notify_array(1)[1])36 37  !ERROR: Must be a scalar value, but is a rank-1 array38  notify wait(notify_array)39 40  !_____________ invalid event-wait-spec-lists: invalid until-spec _________________41 42  !ERROR: Must have INTEGER type, but is LOGICAL(4)43  notify wait(notify_var, until_count=invalid_type)44 45  !ERROR: Must be a scalar value, but is a rank-1 array46  notify wait(notify_var, until_count=non_scalar)47 48  !_________________ invalid sync-stat-lists: invalid stat= ________________________49 50  !ERROR: Must have INTEGER type, but is LOGICAL(4)51  notify wait(notify_var, stat=invalid_type)52 53  !ERROR: Must be a scalar value, but is a rank-1 array54  notify wait(notify_var, stat=non_scalar)55 56  !________________ invalid sync-stat-lists: invalid errmsg= _______________________57 58  !ERROR: Must have CHARACTER type, but is LOGICAL(4)59  notify wait(notify_var, errmsg=invalid_type)60 61  !ERROR: Must be a scalar value, but is a rank-1 array62  notify wait(notify_var, errmsg=non_scalar_char)63 64  !______ invalid event-wait-spec-lists: redundant event-wait-spec-list ____________65 66  !ERROR: Until-spec in a event-wait-spec-list may not be repeated67  notify wait(notify_var, until_count=count, until_count=count_array(1))68 69  !ERROR: Until-spec in a event-wait-spec-list may not be repeated70  notify wait(notify_var, until_count=count, stat=sync_status, until_count=count_array(1))71 72  !ERROR: Until-spec in a event-wait-spec-list may not be repeated73  notify wait(notify_var, until_count=count, errmsg=error_message, until_count=count_array(1))74 75  !ERROR: Until-spec in a event-wait-spec-list may not be repeated76  notify wait(notify_var, until_count=count, stat=sync_status, errmsg=error_message, until_count=count_array(1))77 78  !ERROR: A stat-variable in a event-wait-spec-list may not be repeated79  notify wait(notify_var, stat=sync_status, stat=superfluous_stat)80 81  !ERROR: A stat-variable in a event-wait-spec-list may not be repeated82  notify wait(notify_var, stat=sync_status, until_count=count, stat=superfluous_stat)83 84  !ERROR: A stat-variable in a event-wait-spec-list may not be repeated85  notify wait(notify_var, stat=sync_status, errmsg=error_message, stat=superfluous_stat)86 87  !ERROR: A stat-variable in a event-wait-spec-list may not be repeated88  notify wait(notify_var, stat=sync_status, until_count=count, errmsg=error_message, stat=superfluous_stat)89 90  !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated91  notify wait(notify_var, errmsg=error_message, errmsg=superfluous_errmsg)92 93  !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated94  notify wait(notify_var, errmsg=error_message, until_count=count, errmsg=superfluous_errmsg)95 96  !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated97  notify wait(notify_var, errmsg=error_message, stat=superfluous_stat, errmsg=superfluous_errmsg)98 99  !ERROR: A errmsg-variable in a event-wait-spec-list may not be repeated100  notify wait(notify_var, errmsg=error_message, until_count=count, stat=superfluous_stat, errmsg=superfluous_errmsg)101 102  !_____________ invalid sync-stat-lists: coindexed stat-variable - C1173 __________________103 104  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object105  notify wait(notify_var, stat=coindexed_integer[1])106 107  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object108  notify wait(notify_var, errmsg=coindexed_character[1])109 110  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object111  notify wait(notify_var, stat=coindexed_integer[1], errmsg=error_message)112 113  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object114  notify wait(notify_var, stat=sync_status, errmsg=coindexed_character[1])115 116  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object117  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object118  notify wait(notify_var, stat=coindexed_integer[1], errmsg=coindexed_character[1])119 120  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object121  !ERROR: The stat-variable or errmsg-variable in a event-wait-spec-list may not be a coindexed object122  notify wait(notify_var, errmsg=coindexed_character[1], stat=coindexed_integer[1])123 124end program test_notify_wait125