<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/159977>159977</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][semantics] `implicit none` may leak to other program units
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
foxtran
</td>
</tr>
</table>
<pre>
With the following example:
```
module t
common /fmcom2/ e, z(1)
end module t
subroutine test(n)
use t
implicit none
integer :: n
end subroutine test
```
flang produces the following output:
```
error: Semantic errors in /app/example.f90
/app/example.f90:2:19: error: No explicit type declared for 'e'
common /fmcom2/ e, z(1)
^
/app/example.f90:2:22: error: No explicit type declared for 'z'
common /fmcom2/ e, z(1)
^
Compiler returned: 1
```
Flang version:
```
flang version 22.0.0git (https://github.com/llvm/llvm-project.git 678dcf13d8fa9c1e5086864ff998e068cbb3160c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
Example on godbolt:
https://godbolt.org/z/zM7W6z5sd
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVMuOnTgQ_RqzKfWVKTCPBQuSDruZzYyU5chAGTwxNvKjc7u_fgT39kzSHY0SBEKyq06dUy8Zgl4sUcfEByYeM5ni6nyn3DV6abPRzc_dZx1XiCuBcsa4r9ouQFe57YZY0TPes4rfX95vbk6GIDLeA0xu25wFhoPaJrchwwGI4Ud4YdjkDFvGe7IzfOMU0uhditoSRAqRYWNvdgApvOLqbTd60hGss3Q7sZEW8nAQKnqwd-C3aN9zVUbaBXbv5jRReKPQpbin-F4gee_8EeMP2qSNeoLzJIA-hcp9Zzjc03NR7eHyw-OiR1b0eXtA_Yv5uwO63rXF551gpslITzMo54FhTQzrU_DPJReY-PT_BBB_jcDLncBPRf_xc-P00W27NuTBU0ze0nyEz98km_F-OIv0RD5oZ9-XQ317DYgXfuGLjsCwWWPcw-GBA8Nh0XFN42VyG8PBmKfX38Pu3d80xcvhVdXNPKm8mBsl2yknwZuqqUql2rYhXjXTOBZ5xaebvj-lX-hoEbg21V9V-ZDsF-u-2gejbbo-LDYdRqsnebY4mcN0d0Ff38v8dKsMOAuLm0dnXluP92903G4vzi8Mh5fj-63-XL2IMGdzV8xt0cqMurwWTVmKHEW2djiX5dji1KJURZ4LLEriRSGKUSlSY5vpDjkK3mLOG9GU4sJzVTVTzqtaNqqmmpWcNqnN5UjZETvTISTqctG2dZ0ZOZIJ5w5BPEvCEI914rszx2NaAiu50SGG_yCijuZcPDcP8cjEh3CfqsDEI7CKfz_qFYdNPoMh-QWiAxdX8scAL15ukKyOIUvedL9WeYbDKSYwHO56njr8JwAA___eqo0V">