1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for semantic errors in sync images statements.
3 ! Some of the errors in this test would be hidden by the errors in
4 ! the test synchronization02a.f90 if they were included in that file,
5 ! and are thus tested here.
7 program test_sync_images
10 integer, parameter :: invalid_rank(*,*) = reshape([1], [1,1])
11 integer sync_status
, non_scalar(2), superfluous_stat
, coindexed_integer
[*]
12 character(len
=128) error_message
, superfluous_errmsg
, coindexed_character
[*]
15 !___ non-standard-conforming statements ___
17 ! Image set shall not depend on the value of stat-variable
18 sync
images(sync_status
, stat
=sync_status
)
20 ! Image set shall not depend on the value of errmsg-variable
21 sync
images(len(error_message
), errmsg
=error_message
)
23 !ERROR: An image-set that is an int-expr must be a scalar or a rank-one array
24 sync
images(invalid_rank
)
26 !ERROR: Must have INTEGER type, but is LOGICAL(4)
27 sync
images([1], stat
=invalid_type
)
29 !ERROR: Must be a scalar value, but is a rank-1 array
30 sync
images(*, stat
=non_scalar
)
32 !ERROR: Must have CHARACTER type, but is LOGICAL(4)
33 sync
images(1, errmsg
=invalid_type
)
35 !ERROR: The stat-variable in a sync-stat-list may not be repeated
36 sync
images(1, stat
=sync_status
, stat
=superfluous_stat
)
38 !ERROR: The stat-variable in a sync-stat-list may not be repeated
39 sync
images(1, stat
=sync_status
, errmsg
=error_message
, stat
=superfluous_stat
)
41 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
42 sync
images([1], errmsg
=error_message
, errmsg
=superfluous_errmsg
)
44 !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
45 sync
images([1], stat
=sync_status
, errmsg
=error_message
, errmsg
=superfluous_errmsg
)
47 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
48 sync
images(*, stat
=coindexed_integer
[1])
50 !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
51 sync
images(1, errmsg
=coindexed_character
[1])
53 end program test_sync_images