xref: /llvm-project/flang/test/Semantics/synchronization02b.f90 (revision f770b1e9544967ce31b3c7eea3cfa87c00936ad2)
121dceb3cSKatherine Rasmussen! RUN: %python %S/test_errors.py %s %flang_fc1
221dceb3cSKatherine Rasmussen! Check for semantic errors in sync images statements.
321dceb3cSKatherine Rasmussen! Some of the errors in this test would be hidden by the errors in
421dceb3cSKatherine Rasmussen! the test synchronization02a.f90 if they were included in that file,
521dceb3cSKatherine Rasmussen! and are thus tested here.
621dceb3cSKatherine Rasmussen
721dceb3cSKatherine Rasmussenprogram test_sync_images
821dceb3cSKatherine Rasmussen  implicit none
921dceb3cSKatherine Rasmussen
1021dceb3cSKatherine Rasmussen  integer, parameter :: invalid_rank(*,*) = reshape([1], [1,1])
1121dceb3cSKatherine Rasmussen  integer sync_status, non_scalar(2), superfluous_stat, coindexed_integer[*]
1221dceb3cSKatherine Rasmussen  character(len=128) error_message, superfluous_errmsg, coindexed_character[*]
1321dceb3cSKatherine Rasmussen  logical invalid_type
1421dceb3cSKatherine Rasmussen
1521dceb3cSKatherine Rasmussen  !___ non-standard-conforming statements ___
1621dceb3cSKatherine Rasmussen
1721dceb3cSKatherine Rasmussen  ! Image set shall not depend on the value of stat-variable
1821dceb3cSKatherine Rasmussen  sync images(sync_status, stat=sync_status)
1921dceb3cSKatherine Rasmussen
2021dceb3cSKatherine Rasmussen  ! Image set shall not depend on the value of errmsg-variable
2121dceb3cSKatherine Rasmussen  sync images(len(error_message), errmsg=error_message)
2221dceb3cSKatherine Rasmussen
23*f770b1e9SKatherine Rasmussen  !ERROR: An image-set that is an int-expr must be a scalar or a rank-one array
2421dceb3cSKatherine Rasmussen  sync images(invalid_rank)
2521dceb3cSKatherine Rasmussen
2621dceb3cSKatherine Rasmussen  !ERROR: Must have INTEGER type, but is LOGICAL(4)
2721dceb3cSKatherine Rasmussen  sync images([1], stat=invalid_type)
2821dceb3cSKatherine Rasmussen
2921dceb3cSKatherine Rasmussen  !ERROR: Must be a scalar value, but is a rank-1 array
3021dceb3cSKatherine Rasmussen  sync images(*, stat=non_scalar)
3121dceb3cSKatherine Rasmussen
3221dceb3cSKatherine Rasmussen  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
3321dceb3cSKatherine Rasmussen  sync images(1, errmsg=invalid_type)
3421dceb3cSKatherine Rasmussen
35*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable in a sync-stat-list may not be repeated
3621dceb3cSKatherine Rasmussen  sync images(1, stat=sync_status, stat=superfluous_stat)
3721dceb3cSKatherine Rasmussen
38*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable in a sync-stat-list may not be repeated
39*f770b1e9SKatherine Rasmussen  sync images(1, stat=sync_status, errmsg=error_message, stat=superfluous_stat)
40*f770b1e9SKatherine Rasmussen
41*f770b1e9SKatherine Rasmussen  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
4221dceb3cSKatherine Rasmussen  sync images([1], errmsg=error_message, errmsg=superfluous_errmsg)
4321dceb3cSKatherine Rasmussen
44*f770b1e9SKatherine Rasmussen  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
45*f770b1e9SKatherine Rasmussen  sync images([1], stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg)
46*f770b1e9SKatherine Rasmussen
47*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
4821dceb3cSKatherine Rasmussen  sync images(*, stat=coindexed_integer[1])
4921dceb3cSKatherine Rasmussen
50*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
5121dceb3cSKatherine Rasmussen  sync images(1, errmsg=coindexed_character[1])
5221dceb3cSKatherine Rasmussen
5321dceb3cSKatherine Rasmussenend program test_sync_images
54