xref: /llvm-project/flang/test/Semantics/synchronization04b.f90 (revision f770b1e9544967ce31b3c7eea3cfa87c00936ad2)
121dceb3cSKatherine Rasmussen! RUN: %python %S/test_errors.py %s %flang_fc1
221dceb3cSKatherine Rasmussen! This test checks for semantic errors in sync team statements.
321dceb3cSKatherine Rasmussen! Some of the errors in this test would be hidden by the errors in
421dceb3cSKatherine Rasmussen! the test synchronization04a.f90 if they were included in that file,
521dceb3cSKatherine Rasmussen! and are thus tested here.
621dceb3cSKatherine Rasmussen
721dceb3cSKatherine Rasmussenprogram test_sync_team
821dceb3cSKatherine Rasmussen  use iso_fortran_env, only : team_type
921dceb3cSKatherine Rasmussen  implicit none
1021dceb3cSKatherine Rasmussen
1121dceb3cSKatherine Rasmussen  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1), not_a_team
1221dceb3cSKatherine Rasmussen  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
1321dceb3cSKatherine Rasmussen  logical invalid_type
1421dceb3cSKatherine Rasmussen  type(team_type) warriors
1521dceb3cSKatherine Rasmussen
1621dceb3cSKatherine Rasmussen  !___ non-standard-conforming statements ___
1721dceb3cSKatherine Rasmussen
1821dceb3cSKatherine Rasmussen  !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV
1921dceb3cSKatherine Rasmussen  sync team(not_a_team)
2021dceb3cSKatherine Rasmussen
2121dceb3cSKatherine Rasmussen  !ERROR: Must have INTEGER type, but is LOGICAL(4)
2221dceb3cSKatherine Rasmussen  sync team(warriors, stat=invalid_type)
2321dceb3cSKatherine Rasmussen
2421dceb3cSKatherine Rasmussen  !ERROR: Must be a scalar value, but is a rank-1 array
2521dceb3cSKatherine Rasmussen  sync team(warriors, stat=non_scalar)
2621dceb3cSKatherine Rasmussen
2721dceb3cSKatherine Rasmussen  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
2821dceb3cSKatherine Rasmussen  sync team(warriors, errmsg=invalid_type)
2921dceb3cSKatherine Rasmussen
30*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable in a sync-stat-list may not be repeated
3121dceb3cSKatherine Rasmussen  sync team(warriors, stat=sync_status, stat=superfluous_stat)
3221dceb3cSKatherine Rasmussen
33*f770b1e9SKatherine Rasmussen  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
3421dceb3cSKatherine Rasmussen  sync team(warriors, errmsg=error_message, errmsg=superfluous_errmsg)
3521dceb3cSKatherine Rasmussen
36*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable in a sync-stat-list may not be repeated
37*f770b1e9SKatherine Rasmussen  sync team(warriors, stat=sync_status, errmsg=error_message, stat=superfluous_stat)
38*f770b1e9SKatherine Rasmussen
39*f770b1e9SKatherine Rasmussen  !ERROR: The errmsg-variable in a sync-stat-list may not be repeated
40*f770b1e9SKatherine Rasmussen  sync team(warriors, stat=sync_status, errmsg=error_message, errmsg=superfluous_errmsg)
41*f770b1e9SKatherine Rasmussen
42*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
4321dceb3cSKatherine Rasmussen  sync team(warriors, stat=co_indexed_integer[1])
4421dceb3cSKatherine Rasmussen
45*f770b1e9SKatherine Rasmussen  !ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
4621dceb3cSKatherine Rasmussen  sync team(warriors, errmsg=co_indexed_character[1])
4721dceb3cSKatherine Rasmussen
4821dceb3cSKatherine Rasmussenend program test_sync_team
49