Fortran · 823 bytes Raw Blame History
1 ! audit31 Finding 16: F2018 §11.1.4 gives a BLOCK construct its own
2 ! implicit-typing environment. Outer `implicit none` plus a block-
3 ! scoped `implicit integer (i-n)` should let `n` be implicitly typed
4 ! inside the block. The Stmt::Block AST dropped the parsed implicit
5 ! decls, the IMPLICIT NONE walker ignored block-local rules, and the
6 ! lowerer never allocated implicitly-typed locals. Carry an
7 ! `implicit: Vec<SpannedDecl>` field on Stmt::Block, layer the
8 ! covering letters into walk_stmt_for_undeclared, and pre-walk the
9 ! block body in the lowerer to synthesise TypeDecls for any
10 ! implicitly-typed name the body references. Task #497.
11 ! CHECK: 15
12 program audit31_implicit_block
13 implicit none
14 integer :: a
15 a = 5
16 block
17 implicit integer (i-n)
18 n = a + 10
19 print *, n
20 end block
21 end program
22