xref: /llvm-project/flang/test/Semantics/modfile24.f90 (revision dc453dcf760e6d558da3a4d7fff301baa5f37aba)
1! RUN: %python %S/test_modfile.py %s %flang_fc1
2! Test declarations with coarray-spec
3
4! Different ways of declaring the same coarray.
5module m1
6  real :: a(1:5)[1:10,1:*]
7  real, dimension(5) :: b[1:10,1:*]
8  real, codimension[1:10,1:*] :: c(5)
9  real, codimension[1:10,1:*], dimension(5) :: d
10  codimension :: e[1:10,1:*]
11  dimension :: e(5)
12  real :: e
13end
14!Expect: m1.mod
15!module m1
16! real(4)::a(1_8:5_8)[1_8:10_8,1_8:*]
17! real(4)::b(1_8:5_8)[1_8:10_8,1_8:*]
18! real(4)::c(1_8:5_8)[1_8:10_8,1_8:*]
19! real(4)::d(1_8:5_8)[1_8:10_8,1_8:*]
20! real(4)::e(1_8:5_8)[1_8:10_8,1_8:*]
21!end
22
23! coarray-spec in codimension and target statements.
24module m2
25  codimension :: a[10,*], b[*]
26  target :: c[10,*], d[*]
27end
28!Expect: m2.mod
29!module m2
30! real(4)::a[1_8:10_8,1_8:*]
31! real(4)::b[1_8:*]
32! real(4),target::c[1_8:10_8,1_8:*]
33! real(4),target::d[1_8:*]
34!end
35
36! coarray-spec in components and with non-constants bounds
37module m3
38  type t
39    real, allocatable :: c[:,:]
40    complex, allocatable, codimension[:,:] :: d
41  end type
42  real, allocatable :: e[:,:,:]
43contains
44  subroutine s(a, b, n)
45    integer(8) :: n
46    real :: a[1:n,2:*]
47    real, codimension[1:n,2:*] :: b
48  end
49end
50!Expect: m3.mod
51!module m3
52! type::t
53!  real(4),allocatable::c[:,:]
54!  complex(4),allocatable::d[:,:]
55! end type
56! real(4),allocatable::e[:,:,:]
57!contains
58! subroutine s(a,b,n)
59!  integer(8)::n
60!  real(4)::a[1_8:n,2_8:*]
61!  real(4)::b[1_8:n,2_8:*]
62! end
63!end
64
65! coarray-spec in both attributes and entity-decl
66module m4
67  real, codimension[2:*], dimension(2:5) :: a, b(4,4), c[10,*], d(4,4)[10,*]
68end
69!Expect: m4.mod
70!module m4
71! real(4)::a(2_8:5_8)[2_8:*]
72! real(4)::b(1_8:4_8,1_8:4_8)[2_8:*]
73! real(4)::c(2_8:5_8)[1_8:10_8,1_8:*]
74! real(4)::d(1_8:4_8,1_8:4_8)[1_8:10_8,1_8:*]
75!end
76