<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/130270>130270</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Flang is unable to use a module it compiled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
inaki-amatria
</td>
</tr>
</table>
<pre>
- `flang` version is: `flang version 21.0.0git (https://github.com/llvm/llvm-project.git 9a65dc95133fba5e05eda3bb7b14f061d56dcd0b)`
- Reduced test case:
```fortran
! foo.f90
module foo
contains
function doFoo() result(ptr)
character :: str
pointer(ptr, str)
ptr = 0
end
end
! bar.f90
program main
use foo
character :: str
pointer(ptr, str)
ptr = doFoo()
end
```
- `flang` invocation is: `flang -fimplicit-none foo.f90 bar.f90`
- Expected behavior is: The code compiles successfully
- Actual behavior: Compilation aborts with the following error:
```
error: Semantic errors in bar.f90
./foo.mod:6:13: error: No explicit type declared for 'str'
pointer(ptr,str)
^^^
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlM2u7CYMx5-GbKyJCORjssgivefOsou2L8CHM6ElEAGZe8_bV2SSOUdHbaVKEZFs__DfNiBiNHeHOJDmF9K8FWJLsw-DceIvcxGLSMGIQnr9PlyAtHSywt1JS-GBIRrvwETCx5fnZWZVSUt6NwkIu84prTmMsBtht7tJ8yZL5RfCbtY-zt9lDf5PVKnMVC_aRqu-qTifpGiQNqgFl7KTVT3RttJNq5WmkrCetJTQ8QK_od4UakgYEygRMWekY3bv3-RDCsJlE6tg8r6c-kwuXm8Ws4HQUXmXhHGR0BFg2pxKuRrtb94TdiWsh4Bxs4mw65pCzp4DAdQsglAJA-SsfISYwuFavXEJw0l8210vcE0ZeQMK2YBOEzo-10OoFOEQugZ_D2KBRRi301s8Zf-7gP_Kfub-VN5H9rNte28_T964h1ci_cPwL5NZVmuUSRfnHZ49fpVwbPb954oqoQaJs3gYH459_pgRlNd5WVZjMULclMIYp83a9x0dVdqEfYGZ-rYHP_UI6UOK8MOkGdKcBVjrfxh3BwxhD_9S2WmG33ERLhn1DIxg3KfGl4Tdci2L14SPLeFjxTP0on_1gD-flUN6XxE0KisCaph8AMK6vends-lfBvIxD9J8P75PIgs9cN3zXhQ4VF1d8bq-tm0xD6ytOyoYnWSHnWaKq6lvmOhFK5uey7YwA6OsoZx2FW1q1pZX1la1rqsrZ1eJfU9qioswtsy3r_ThXpgYNxwqTllHCysk2ni-C2HY76jc7pHU1JqY4geXTLL7C_I8JM0b3PYDYSJsTkiLkPx-WgUct82kc8q62IId_t8TQdhtlxoJux1qHwP7OwAA___lK3m_">