xref: /llvm-project/flang/test/Semantics/implicit11.f90 (revision d38765604f9372dab74a82b573302bd6401c6698)
1! RUN: %python %S/test_errors.py %s %flang_fc1
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    !WARN: '%s' was used without (or before) being explicitly typed
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