1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 ! Check for semantic errors in sync images statements
5 program test_sync_images
8 integer, parameter :: invalid_rank(*,*) = reshape([1], [1,1])
9 integer sync_status
, non_scalar(2), superfluous_stat
, coindexed_integer
[*], me
10 character(len
=128) error_message
, superfluous_errmsg
, coindexed_character
[*]
13 !___ standard-conforming statement ___
15 sync
images(*, stat
=sync_status
, errmsg
=error_message
)
16 sync
images(*, stat
=sync_status
)
17 sync
images(*, errmsg
=error_message
)
20 sync
images(me
, stat
=sync_status
, errmsg
=error_message
)
21 sync
images(me
+1, stat
=sync_status
, errmsg
=error_message
)
22 sync
images(1, stat
=sync_status
, errmsg
=error_message
)
23 sync
images(1, stat
=sync_status
)
24 sync
images(1, errmsg
=error_message
)
27 sync
images([1], stat
=sync_status
, errmsg
=error_message
)
28 sync
images([1], stat
=sync_status
)
29 sync
images([1], errmsg
=error_message
)
32 !___ non-standard-conforming statement ___
34 !______ invalid image sets ______
36 ! Image set shall not depend on the value of stat-variable
38 sync
images(sync_status
, stat
=sync_status
)
40 ! Image set shall not depend on the value of errmsg-variable
42 sync
images(len(error_message
), errmsg
=error_message
)
44 ! Image set shall be a scalar or rank-1 array
46 sync
images(invalid_rank
)
48 !______ invalid sync-stat-lists: invalid stat= ____________
50 ! Invalid sync-stat-list keyword
52 sync
images(1, status
=sync_status
)
55 sync
images([1], stat
=invalid_type
)
57 ! Stat-variable must an integer scalar
59 sync
images(*, stat
=non_scalar
)
61 ! Invalid sync-stat-list: missing stat-variable
65 ! Invalid sync-stat-list: missing 'stat='
67 sync
images([1], sync_status
)
69 !______ invalid sync-stat-lists: invalid errmsg= ____________
71 ! Invalid errmsg-variable keyword
73 sync
images(*, errormsg
=error_message
)
76 sync
images(1, errmsg
=invalid_type
)
78 ! Invalid sync-stat-list: missing 'errmsg='
80 sync
images([1], error_message
)
82 ! Invalid sync-stat-list: missing errmsg-variable
84 sync
images(*, errmsg
)
86 !______ invalid sync-stat-lists: redundant sync-stat-list ____________
88 ! No specifier shall appear more than once in a given sync-stat-list
89 !ERROR: to be determined
90 sync
images(1, stat
=sync_status
, stat
=superfluous_stat
)
92 ! No specifier shall appear more than once in a given sync-stat-list
93 !ERROR: to be determined
94 sync
images([1], errmsg
=error_message
, errmsg
=superfluous_errmsg
)
96 !______ invalid sync-stat-lists: coindexed stat-variable ____________
98 ! Check constraint C1173 from the Fortran 2018 standard
99 !ERROR: to be determined
100 sync
images(*, stat
=coindexed_integer
[1])
102 ! Check constraint C1173 from the Fortran 2018 standard
103 !ERROR: to be determined
104 sync
images(1, errmsg
=coindexed_character
[1])
106 end program test_sync_images