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