xref: /llvm-project/flang/test/Semantics/image_index01.f90 (revision 8b38970811086b09752a5909d0c17de4d0cd04c3)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Ensure standard-conforming image_index function references are
3! accepted, based on the 16.9.107 section of the Fortran 2023 standard
4
5program image_index_test
6  use iso_fortran_env, only: team_type
7  implicit none
8
9  integer n, array(1), team_num
10  integer scalar_coarray[*], array_coarray(1)[*], coarray_corank3[10, 0:9, 0:*]
11  integer subscripts_corank1(1), subscripts_corank3(3)
12  type(team_type) :: home, league(2)
13
14  !___ standard-conforming statements - IMAGE_INDEX(COARRAY, SUB) ___
15  n = image_index(scalar_coarray, [1])
16  n = image_index(scalar_coarray, subscripts_corank1)
17  n = image_index(array_coarray, [1])
18  n = image_index(array_coarray, subscripts_corank1)
19  n = image_index(coarray=scalar_coarray, sub=subscripts_corank1)
20  n = image_index(coarray_corank3, subscripts_corank3)
21  n = image_index(sub=subscripts_corank1, coarray=scalar_coarray)
22
23  !___ standard-conforming statements - IMAGE_INDEX(COARRAY, SUB, TEAM) ___
24  n = image_index(scalar_coarray, [1], home)
25  n = image_index(scalar_coarray, subscripts_corank1, league(1))
26  n = image_index(array_coarray, [1], home)
27  n = image_index(array_coarray, subscripts_corank1, league(1))
28  n = image_index(coarray_corank3, subscripts_corank3, league(1))
29  n = image_index(coarray=scalar_coarray, sub=subscripts_corank1, team=home)
30  n = image_index(team=home, sub=[1], coarray=scalar_coarray)
31
32  !___ standard-conforming statements - IMAGE_INDEX(COARRAY, SUB, TEAM_NUMBER) ___
33  n = image_index(scalar_coarray, [1], team_num)
34  n = image_index(scalar_coarray, subscripts_corank1, team_number=team_num)
35  n = image_index(array_coarray, [1], team_num)
36  n = image_index(array_coarray, subscripts_corank1, array(1))
37  n = image_index(coarray_corank3, subscripts_corank3, team_num)
38  n = image_index(coarray=scalar_coarray, sub=subscripts_corank1, team_number=team_num)
39  n = image_index(team_number=team_num, sub=[1], coarray=scalar_coarray)
40
41end program image_index_test
42