<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62047>62047</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] implicit none(external) breaks array subscripting
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tttapa
</td>
</tr>
</table>
<pre>
### Problem
When using `implicit none(external)`, Flang seems to interpret the names of arrays in subscript expressions as names of undeclared functions, raising an error.
### Reproduction
```f90
program hello
implicit none (type, external)
real, parameter :: x(3) = (/1, 2, 3/)
integer :: i
do i = 1,3
print *, x(i)
end do
end program
```
```sh
flang-new-16 hello.f90 -flang-experimental-exec
```
```text
error: Semantic errors in hello.f90
./hello.f90:7:18: error: 'x' is an external procedure without the EXTERNAL attribute in a scope with IMPLICIT NONE(EXTERNAL)
print *, x(i)
^
```
Removing the `implicit none (external)` causes it to compile correctly.
### Version
```sh
Ubuntu flang-new version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-16/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVEtv4zYQ_jX0ZWCBImVJPujgxBEQYJsu0vRxKyhxLLGlSIGkssplf3tBybGz3nZrCAQ87--bh_BedQaxIrs7sjtuxBR666oQghjFprHyrSKMrx98drbROBB6JPTwe48GJq9MBySnahi1alUAYw0SVuIc0BmhCduTnBJ2D7UWpgOPOHgIFpQJ6EaHAUKPYMSAHuwJhHPizYMy4KfGt06NAXAeHXqvrPEg_NV2MhJbLRxKOE2mDdEgZnJCLWUJA-icdcla8Pm9oHnG0Vk5LX5nXU7X77Snq2R0tnNigB61tqsIAOAbtEBYGd5GjKk_wv6QNPo4jOJ7GIUTAwZ0QPiB8APMhJWcsD0QfoyxCKvTaMjiwwmrL8GW1CZgd3VWV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