[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / form_team01.f90
blob3b82e5b41666e88238361cb8a919b8c98b711cd5
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for semantic errors in form team statements
4 subroutine test
5 use, intrinsic :: iso_fortran_env, only: team_type
6 type(team_type) :: team
7 integer :: team_number
8 integer :: team_index
9 integer :: statvar
10 character(len=50) :: errvar
11 integer, codimension[*] :: co_team_number
12 integer, codimension[*] :: co_team_index
13 type(team_type), dimension(1) :: array_team
14 integer, dimension(1) :: array_team_number
15 integer, dimension(1) :: array_team_index
16 integer, dimension(1) :: array_statvar
17 character(len=50), dimension(1) :: array_errvar
19 logical :: invalid_argument
21 ! Valid invocations which should produce no errors.
22 FORM TEAM (team_number, team)
23 ! One form-team-spec argument.
24 FORM TEAM (team_number, team, NEW_INDEX=team_index)
25 FORM TEAM (team_number, team, STAT=statvar)
26 FORM TEAM (team_number, team, ERRMSG=errvar)
27 ! Two form-team-spec arguments in any order.
28 FORM TEAM (team_number, team, NEW_INDEX=team_index, STAT=statvar)
29 FORM TEAM (team_number, team, STAT=statvar, NEW_INDEX=team_index)
30 FORM TEAM (team_number, team, NEW_INDEX=team_index, ERRMSG=errvar)
31 FORM TEAM (team_number, team, ERRMSG=errvar, NEW_INDEX=team_index)
32 FORM TEAM (team_number, team, STAT=statvar, ERRMSG=errvar)
33 FORM TEAM (team_number, team, ERRMSG=errvar, STAT=statvar)
34 ! Three form-team-spec arguments in any order.
35 FORM TEAM (team_number, team, NEW_INDEX=team_index, STAT=statvar, ERRMSG=errvar) ! identity
36 FORM TEAM (team_number, team, STAT=statvar, NEW_INDEX=team_index, ERRMSG=errvar) ! transposition (1,2)
37 FORM TEAM (team_number, team, ERRMSG=errvar, STAT=statvar, NEW_INDEX=team_index) ! transposition (1,3)
38 FORM TEAM (team_number, team, NEW_INDEX=team_index, ERRMSG=errvar, STAT=statvar) ! transposition (2,3)
39 FORM TEAM (team_number, team, ERRMSG=errvar, NEW_INDEX=team_index, STAT=statvar) ! cycle (1,2,3)
40 FORM TEAM (team_number, team, STAT=statvar, ERRMSG=errvar, NEW_INDEX=team_index) ! cycle (1,3,2)
41 ! It is semantically legal for team_index to be coindexed.
42 FORM TEAM (team_number, team, NEW_INDEX=co_team_index[this_image()])
44 ! Semantically invalid invocations.
45 !ERROR: Must have INTEGER type, but is LOGICAL(4)
46 FORM TEAM (invalid_argument, team)
47 !ERROR: Must have INTEGER type, but is REAL(4)
48 FORM TEAM (0.0, team)
49 !ERROR: Must have INTEGER type, but is LOGICAL(4)
50 FORM TEAM (team_number, team, NEW_INDEX=invalid_argument)
51 !ERROR: Must have INTEGER type, but is LOGICAL(4)
52 FORM TEAM (team_number, team, STAT=invalid_argument)
53 !ERROR: Must have CHARACTER type, but is LOGICAL(4)
54 FORM TEAM (team_number, team, ERRMSG=invalid_argument)
56 ! Arguments with rank mismatches.
57 !ERROR: Must be a scalar value, but is a rank-1 array
58 FORM TEAM (array_team_number, team)
59 !ERROR: Must be a scalar value, but is a rank-1 array
60 FORM TEAM (team_number, array_team)
61 !ERROR: Must be a scalar value, but is a rank-1 array
62 FORM TEAM (team_number, team, NEW_INDEX=array_team_index)
63 !ERROR: Must be a scalar value, but is a rank-1 array
64 FORM TEAM (team_number, team, STAT=array_statvar)
65 !ERROR: Must be a scalar value, but is a rank-1 array
66 FORM TEAM (team_number, team, ERRMSG=array_errvar)
67 end subroutine