1! RUN: %S/test_errors.sh %s %t %f18
2
3! Test use of implicitly declared variable in specification expression
4
5subroutine s1()
6  m = 1
7contains
8  subroutine s1a()
9    implicit none
10    !ERROR: No explicit type declared for 'n'
11    real :: a(m, n)
12  end
13  subroutine s1b()
14    !ERROR: Implicitly typed local entity 'n' not allowed in specification expression
15    real :: a(m, n)
16  end
17end
18
19subroutine s2()
20  type :: t(m, n)
21    integer, len :: m
22    integer, len :: n
23  end type
24  n = 1
25contains
26  subroutine s2a()
27    !ERROR: Implicitly typed local entity 'm' not allowed in specification expression
28    type(t(m, n)) :: a
29  end
30  subroutine s2b()
31    implicit none
32    !ERROR: No explicit type declared for 'm'
33    character(m) :: a
34  end
35end
36
37subroutine s3()
38  m = 1
39contains
40  subroutine s3a()
41    implicit none
42    real :: a(m, n)
43    !ERROR: No explicit type declared for 'n'
44    common n
45  end
46  subroutine s3b()
47    ! n is okay here because it is in a common block
48    real :: a(m, n)
49    common n
50  end
51end
52
53subroutine s4()
54  implicit none
55contains
56  subroutine s4a()
57    !ERROR: No explicit type declared for 'n'
58    real :: a(n)
59  end
60end
61
62