|
| 1 | +! RUN: %python %S/test_errors.py %s %flang_fc1 |
| 2 | +! There are sync-stat-lists in critical-stmt, sync-all-stmt, |
| 3 | +! sync-images-stmt, sync-memory-stmt, sync-team-stmt, |
| 4 | +! event-post-stmt, unlock-stmt, change-team-stmt, and end-change-team-stmt. |
| 5 | +! |
| 6 | +! Some of these statements have their sync-stat-lists tested in other tests. |
| 7 | +! This test contains the statements that do not, namely critical-stmt, unlock-stmt, |
| 8 | +! change-team-stmt, and end-change-team-stmt. |
| 9 | + |
| 10 | +program test_sync_stat_list |
| 11 | + use iso_fortran_env, only: team_type, lock_type |
| 12 | + |
| 13 | + implicit none |
| 14 | + |
| 15 | + integer coarray[*], sync_status, non_scalar(2), superfluous_stat, coindexed_integer[*] |
| 16 | + character(len=128) error_message, superfluous_errmsg, coindexed_character[*] |
| 17 | + logical invalid_type |
| 18 | + type(team_type) :: home |
| 19 | + type(lock_type) :: latch |
| 20 | + |
| 21 | + ! valid |
| 22 | + change team (home, stat=sync_status, errmsg=error_message) |
| 23 | + end team (stat=sync_status, errmsg=error_message) |
| 24 | + |
| 25 | + !ERROR: Must be a scalar value, but is a rank-1 array |
| 26 | + change team (home, stat=non_scalar, errmsg=error_message) |
| 27 | + end team |
| 28 | + |
| 29 | + !ERROR: Must have INTEGER type, but is LOGICAL(4) |
| 30 | + change team (home, stat=invalid_type, errmsg=error_message) |
| 31 | + end team |
| 32 | + |
| 33 | + !ERROR: Must have CHARACTER type, but is LOGICAL(4) |
| 34 | + change team (home, stat=sync_status, errmsg=invalid_type) |
| 35 | + end team |
| 36 | + |
| 37 | + change team (home) |
| 38 | + !ERROR: Must be a scalar value, but is a rank-1 array |
| 39 | + end team (stat=non_scalar, errmsg=error_message) |
| 40 | + |
| 41 | + change team (home) |
| 42 | + !ERROR: Must have INTEGER type, but is LOGICAL(4) |
| 43 | + end team (stat=invalid_type, errmsg=error_message) |
| 44 | + |
| 45 | + change team (home) |
| 46 | + !ERROR: Must have CHARACTER type, but is LOGICAL(4) |
| 47 | + end team (stat=sync_status, errmsg=invalid_type) |
| 48 | + |
| 49 | + !ERROR: The stat-variable in a sync-stat-list may not be repeated |
| 50 | + change team (home, stat=sync_status, errmsg=error_message, stat=superfluous_stat) |
| 51 | + end team |
| 52 | + |
| 53 | + !ERROR: The errmsg-variable in a sync-stat-list may not be repeated |
| 54 | + change team (home, stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg) |
| 55 | + end team |
| 56 | + |
| 57 | + change team (home) |
| 58 | + !ERROR: The stat-variable in a sync-stat-list may not be repeated |
| 59 | + end team (stat=sync_status, errmsg=error_message, stat=superfluous_stat) |
| 60 | + |
| 61 | + change team (home) |
| 62 | + !ERROR: The errmsg-variable in a sync-stat-list may not be repeated |
| 63 | + end team (stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg) |
| 64 | + |
| 65 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 66 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 67 | + change team (home, stat=coindexed_integer[1], errmsg=coindexed_character[1]) |
| 68 | + end team |
| 69 | + |
| 70 | + change team (home) |
| 71 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 72 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 73 | + end team (stat=coindexed_integer[1], errmsg=coindexed_character[1]) |
| 74 | + |
| 75 | + ! valid |
| 76 | + unlock (latch, stat=sync_status, errmsg=error_message) |
| 77 | + |
| 78 | + !ERROR: Must be a scalar value, but is a rank-1 array |
| 79 | + unlock (latch, stat=non_scalar, errmsg=error_message) |
| 80 | + |
| 81 | + !ERROR: Must have INTEGER type, but is LOGICAL(4) |
| 82 | + unlock (latch, stat=invalid_type, errmsg=error_message) |
| 83 | + |
| 84 | + !ERROR: Must have CHARACTER type, but is LOGICAL(4) |
| 85 | + unlock (latch, stat=sync_status, errmsg=invalid_type) |
| 86 | + |
| 87 | + !ERROR: The stat-variable in a sync-stat-list may not be repeated |
| 88 | + unlock (latch, stat=sync_status, stat=superfluous_stat) |
| 89 | + |
| 90 | + !ERROR: The errmsg-variable in a sync-stat-list may not be repeated |
| 91 | + unlock (latch, stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg) |
| 92 | + |
| 93 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 94 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 95 | + unlock (latch, stat=coindexed_integer[1], errmsg=coindexed_character[1]) |
| 96 | + |
| 97 | + ! valid |
| 98 | + critical (stat=sync_status, errmsg=error_message) |
| 99 | + end critical |
| 100 | + |
| 101 | + !ERROR: Must be a scalar value, but is a rank-1 array |
| 102 | + critical (stat=non_scalar, errmsg=error_message) |
| 103 | + end critical |
| 104 | + |
| 105 | + !ERROR: Must have INTEGER type, but is LOGICAL(4) |
| 106 | + critical (stat=invalid_type, errmsg=error_message) |
| 107 | + end critical |
| 108 | + |
| 109 | + !ERROR: Must have CHARACTER type, but is LOGICAL(4) |
| 110 | + critical (stat=sync_status, errmsg=invalid_type) |
| 111 | + end critical |
| 112 | + |
| 113 | + !ERROR: The stat-variable in a sync-stat-list may not be repeated |
| 114 | + critical (stat=sync_status, errmsg=error_message, stat=superfluous_stat) |
| 115 | + end critical |
| 116 | + |
| 117 | + !ERROR: The errmsg-variable in a sync-stat-list may not be repeated |
| 118 | + critical (stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg) |
| 119 | + end critical |
| 120 | + |
| 121 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 122 | + !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object |
| 123 | + critical (stat=coindexed_integer[1], errmsg=coindexed_character[1]) |
| 124 | + end critical |
| 125 | + |
| 126 | +end program test_sync_stat_list |
0 commit comments