129 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in event post statements based on the3! statement specification in section 11.6.7 of the Fortran 2018 standard.4! Some of the errors in this test would be hidden by the errors in5! the test event01a.f90 if they were included in that file,6! and are thus tested here.7 8program test_event_post9 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 ! event_type potential object components must be nested in coarrays17 type :: has_event18 type(event_type) event19 end type20 type :: bad121 type(has_event) component22 end type23 type :: bad224 type(has_event), allocatable :: component25 end type26 type :: good127 type(has_event), pointer :: component28 end type29 type :: good230 type(has_event), allocatable :: component[:]31 end type32 !ERROR: Variable 'non_coarray_component1' with EVENT_TYPE or LOCK_TYPE potential component '%event' must be a coarray33 type(has_event) non_coarray_component134 !ERROR: Variable 'non_coarray_component2' with EVENT_TYPE or LOCK_TYPE potential component '%component%event' must be a coarray35 type(bad1) non_coarray_component236 !ERROR: Variable 'non_coarray_component3' with EVENT_TYPE or LOCK_TYPE potential component '%component%event' must be a coarray37 type(bad2) non_coarray_component338 ! these are okay39 type(has_event) ok_non_coarray_component1[*]40 type(has_event), pointer :: ok_non_coarray_component241 type(bad1) :: ok_non_coarray_component3[*]42 type(bad1), pointer :: ok_non_coarray_component443 type(bad2) :: ok_non_coarray_component5[*]44 type(bad2), pointer :: ok_non_coarray_component645 type(good1) ok_non_coarray_component746 type(good2) ok_non_coarray_component847 48 type(event_type) concert[*], occurrences(2)[*]49 integer non_event[*], sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)50 character(len=128) error_message, co_indexed_character[*], superfluous_errmsg51 logical invalid_type52 53 !___ non-standard-conforming statements ___54 55 !______ invalid event-variable ____________________________56 57 ! event-variable must be event_type58 !ERROR: The event-variable must be of type EVENT_TYPE from module ISO_FORTRAN_ENV59 event post(non_event)60 61 !ERROR: Must be a scalar value, but is a rank-1 array62 event post(occurrences)63 64 !ERROR: Must be a scalar value, but is a rank-1 array65 event post(occurrences(:)[1])66 67 !______ invalid sync-stat-lists: invalid stat= ____________68 69 !ERROR: Must have INTEGER type, but is LOGICAL(4)70 event post(concert, stat=invalid_type)71 72 !ERROR: Must be a scalar value, but is a rank-1 array73 event post(concert, stat=non_scalar)74 75 !______ invalid sync-stat-lists: invalid errmsg= ____________76 77 !ERROR: Must have CHARACTER type, but is LOGICAL(4)78 event post(concert, errmsg=invalid_type)79 80 !______ invalid sync-stat-lists: redundant sync-stat-list ____________81 82 !ERROR: The stat-variable in a sync-stat-list may not be repeated83 event post(concert, stat=sync_status, stat=superfluous_stat)84 85 !ERROR: The stat-variable in a sync-stat-list may not be repeated86 event post(concert, errmsg=error_message, stat=sync_status, stat=superfluous_stat)87 88 !ERROR: The stat-variable in a sync-stat-list may not be repeated89 event post(concert, stat=sync_status, errmsg=error_message, stat=superfluous_stat)90 91 !ERROR: The stat-variable in a sync-stat-list may not be repeated92 event post(concert, stat=sync_status, stat=superfluous_stat, errmsg=error_message)93 94 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated95 event post(concert, errmsg=error_message, errmsg=superfluous_errmsg)96 97 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated98 event post(concert, stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg)99 100 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated101 event post(concert, errmsg=error_message, stat=sync_status, errmsg=superfluous_errmsg)102 103 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated104 event post(concert, errmsg=error_message, errmsg=superfluous_errmsg, stat=sync_status)105 106 !______ invalid sync-stat-lists: coindexed stat-variable - C1173____________107 108 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object109 event post(concert, stat=co_indexed_integer[1])110 111 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object112 event post(concert, errmsg=co_indexed_character[1])113 114 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object115 event post(concert, stat=co_indexed_integer[1], errmsg=error_message)116 117 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object118 event post(concert, stat=sync_status, errmsg=co_indexed_character[1])119 120 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object121 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object122 event post(concert, stat=co_indexed_integer[1], errmsg=co_indexed_character[1])123 124 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object125 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object126 event post(concert, errmsg=co_indexed_character[1], stat=co_indexed_integer[1])127 128end program test_event_post129