[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / resolve40.f90
blob331c5ebd02c0e59bbc03a79c05567cc09d4e7c0d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 subroutine s1
3 namelist /nl/x
4 block
5 !ERROR: NAMELIST statement is not allowed in a BLOCK construct
6 namelist /nl/y
7 end block
8 end
10 subroutine s2
11 open(12, file='nl.out')
12 !ERROR: Namelist group 'nl' not found
13 write(12, nml=nl)
14 end
16 subroutine s3
17 real :: x
18 open(12, file='nl.out')
19 !ERROR: 'x' is not the name of a namelist group
20 write(12, nml=x)
21 end
23 module m4
24 real :: x
25 namelist /nl/x
26 end
27 subroutine s4a
28 use m4
29 namelist /nl2/x
30 open(12, file='nl.out')
31 write(12, nml=nl)
32 write(12, nml=nl2)
33 end
34 subroutine s4b
35 use m4
36 real :: y
37 !ERROR: 'nl' is already declared in this scoping unit
38 namelist /nl/y
39 end
41 subroutine s5
42 namelist /nl/x
43 !ERROR: The type of 'x' has already been implicitly declared
44 integer x
45 end
47 subroutine s6
48 !ERROR: 's6' is not a variable
49 namelist /nl/ s6
50 !ERROR: 'f' is not a variable
51 namelist /nl/ f
52 contains
53 integer function f()
54 f = 1
55 end
56 end
58 subroutine s7
59 real x
60 namelist /nl/ x
61 !ERROR: EXTERNAL attribute not allowed on 'x'
62 external x
63 end
65 subroutine s8
66 data x/1.0/
67 !ERROR: The type of 'x' has already been implicitly declared
68 integer x
69 end
71 subroutine s9
72 real :: x(2,2)
73 !ERROR: 'i' is already declared in this scoping unit
74 data ((x(i,i),i=1,2),i=1,2)/4*0.0/
75 end
77 module m10
78 integer :: x
79 public :: nl
80 namelist /nl/ x
81 end
83 subroutine s11
84 integer :: nl2
85 !ERROR: 'nl2' is already declared in this scoping unit
86 namelist /nl2/x
87 namelist /nl3/x
88 !ERROR: 'nl3' is already declared in this scoping unit
89 integer :: nl3
90 nl2 = 1
91 end