1! RUN: %S/test_modfile.sh %s %f18 %t
2! Verify miscellaneous bugs
3
4! The function result must be declared after the dummy arguments
5module m1
6contains
7  function f1(x) result(y)
8    integer :: x(:)
9    integer :: y(size(x))
10  end
11  function f2(x)
12    integer :: x(:)
13    integer :: f2(size(x))
14  end
15end
16
17!Expect: m1.mod
18!module m1
19!contains
20! function f1(x) result(y)
21!  integer(4)::x(:)
22!  integer(4)::y(1_8:int(int(1_8*size(x,dim=1),kind=4),kind=8))
23! end
24! function f2(x)
25!  integer(4)::x(:)
26!  integer(4)::f2(1_8:int(int(1_8*size(x,dim=1),kind=4),kind=8))
27! end
28!end
29
30! Order of names in PUBLIC statement shouldn't affect .mod file.
31module m2
32  public :: a
33  type t
34  end type
35  type(t), parameter :: a = t()
36end
37
38!Expect: m2.mod
39!module m2
40! type::t
41! end type
42! type(t),parameter::a=t()
43!end
44
45! Don't write out intrinsics
46module m3a
47  integer, parameter :: i4 = selected_int_kind(9)
48end
49module m3b
50  use m3a
51  integer(i4) :: j
52end
53
54!Expect: m3a.mod
55!module m3a
56! integer(4),parameter::i4=4_4
57! intrinsic::selected_int_kind
58!end
59
60!Expect: m3b.mod
61!module m3b
62! use m3a,only:i4
63! use m3a,only:selected_int_kind
64! integer(4)::j
65!end
66
67! Test that character literals written with backslash escapes are read correctly.
68module m4a
69  character(1), parameter :: a = achar(1)
70end
71module m4b
72  use m4a
73  character(1), parameter :: b = a
74end
75
76!Expect: m4a.mod
77!module m4a
78! character(1_4,1),parameter::a="\001"
79! intrinsic::achar
80!end
81
82!Expect: m4b.mod
83!module m4b
84! use m4a,only:a
85! use m4a,only:achar
86! character(1_4,1),parameter::b="\001"
87!end
88
89