[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / implicit11.f90
blob3c68ab5b848b2b8e18c19d0e350a0248887e1ba0
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 ! Test use of implicitly declared variable in specification expression
5 subroutine s1()
6 m = 1
7 contains
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
17 end
19 subroutine s2()
20 type :: t(m, n)
21 integer, len :: m
22 integer, len :: n
23 end type
24 n = 1
25 contains
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
35 end
37 subroutine s3()
38 m = 1
39 contains
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
51 end
53 subroutine s4()
54 implicit none
55 contains
56 subroutine s4a()
57 !ERROR: No explicit type declared for 'n'
58 real :: a(n)
59 end
60 end