Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/coindexed_2.f90

raw
1 !{ dg-do compile }
2
3 program coindexed_2
4 use, intrinsic :: iso_fortran_env
5
6 integer, save :: dim1[*]
7 integer :: ist
8 logical :: cst
9 type(team_type) :: team
10
11 dim1 = 3
12 print *, dim1[1] ! ok
13 print *, dim1['me'] ! { dg-error "Array index at \\\(1\\\) must be of INTEGER" }
14
15 print *, dim1[1, STAT=ist] !ok
16 print *, dim1[1, STAT=cst] ! { dg-error "STAT argument at \\\(1\\\) must be of INTEGER" }
17 print *, dim1[1, STAT=[ist]] ! { dg-error "STAT argument at \\\(1\\\) must be scalar" }
18 print *, dim1[1, STAT=ist, STAT=ist] ! { dg-error "Duplicate" }
19 print *, dim1[STAT=ist, 1] ! { dg-error "Invalid form of" }
20 print *, dim1[5, STAT=ist, 1] ! { dg-error "Invalid form of" }
21 print *, dim1[5, STAT=dim1[1]] ! { dg-error "Expression in STAT= at \\\(1\\\) must not be coindexed" }
22
23 print *, dim1[1, TEAM=team] !ok
24 print *, dim1[1, STAT= ist, TEAM=team] !ok
25 print *, dim1[1, TEAM=team, STAT=ist] !ok
26 print *, dim1[1, STAT=ist, TEAM=team, STAT=ist] ! { dg-error "Duplicate" }
27 print *, dim1[1, TEAM=team, STAT=ist, TEAM=team] ! { dg-error "Duplicate" }
28 print *, dim1[1, TEAM=ist] ! { dg-error "TEAM argument at \\\(1\\\) must be of TEAM_TYPE" }
29 print *, dim1[1, TEAM=[team]] ! { dg-error "TEAM argument at \\\(1\\\) must be scalar" }
30 print *, dim1[TEAM=team, 1] ! { dg-error "Invalid form of" }
31 print *, dim1[5, TEAM=team, 1] ! { dg-error "Invalid form of" }
32
33 print *, dim1[1, TEAM_NUMBER=-1] !ok
34 print *, dim1[1, TEAM_NUMBER=1] !ok
35 print *, dim1[1, TEAM_NUMBER=1.23] ! { dg-error "TEAM_NUMBER argument at \\\(1\\\) must be of INTEGER" }
36 print *, dim1[1, TEAM_NUMBER='me'] ! { dg-error "TEAM_NUMBER argument at \\\(1\\\) must be of INTEGER" }
37 print *, dim1[1, TEAM_NUMBER=5, STAT=ist] !ok
38 print *, dim1[1, TEAM_NUMBER=5, STAT=ist, TEAM_NUMBER=-1] ! { dg-error "Duplicate" }
39 print *, dim1[1, TEAM_NUMBER=-1, TEAM=team] ! { dg-error "Only one of TEAM" }
40 print *, dim1[TEAM_NUMBER=-1, 1] ! { dg-error "Invalid form of" }
41 print *, dim1[5, TEAM_NUMBER=-1, 1] ! { dg-error "Invalid form of" }
42 end program
43
44