<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106929>106929</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when do variables are used for association and selector in associate statement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 20.0.0(675c748bb606d75a959481e6014299849cf3094c)/AArch64
```
When `do variables` are used for `association` and `selector` in `associate` statement, a compilation-time error occurs.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snf_omptest8_01_1.f90:
```fortran
program main
do kaa=1,1
do k=1,1
associate (kaa=>k)
kaa=1
end associate
end do
end do
print *,'pass'
end program main
```
```
$ flang-new snf_omptest8_01_1.f90
error: Semantic errors in snf_omptest8_01_1.f90
./snf_omptest8_01_1.f90:5:11: error: Cannot redefine DO variable 'k'
kaa=1
^^^
./snf_omptest8_01_1.f90:3:9: Enclosing DO construct
do k=1,1
^
$
```
```
$ gfortran snf_omptest8_01_1.f90; ./a.out
pass
$
```
```
$ ifort -diag-disable=10448 snf_omptest8_01_1.f90; ./a.out
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVF2P6yYQ_TXkZRQLjz958ENusunjfWjVPq4wHsfctSECvNv--wo7ySbb3VupqoQSc4A5M8PhSO_1yRA1rPjGisNGzmGwrrGDsdv-x6a13V8NK_ll8APju9_JeW0N2B76UZrT1tAbsGwHyBOecIZ1WRWqyuu2LXnZVYUUhcjrlEqe5ihEnQvVZ1zkiqFgeNztnBrKfA3-gWv9_WMgA6zknYVX6bRsR_Ks5CAdweypg966uC69t0rLoK1Zlk0XUU8jqWBdhLS530cR8kEGmsgEhnuQoOx01uMSYxv0REDOWQdWqdn55D6r3waC3o6jfdPmtOQSBoJAPsDZ2ZOTU4x4vLYoTn7prQtOmiU1HSf3fAyP9CepOX6DIz-P4YHQm_7ZTufIUD_z9DlNesFZtvvQuQvHil4ygUnqCwLQWXiRkmWHlOE-vaKwLnwCA8CtY8CwXg-z7OklXuDDPrhFXmEy3fvZu60R7-wVeJydnTYBGO4Y7hlWZ-k9w2pdjTv_WdKnovkIYn4n189buVLE-45y_pUmaYJWqwJ81M5PjiUMj19dUMGyXZrGmLfge2mMDeCoo14bgsP3m7SBYfVyqxjgq96y4uky_jWBjGU7EWmfjBqtj3o9fAdljQ9uVuGB6WsRANzIGP7svX7S-tNV-V-k-A1i_jKx8zWb5d7_G9n6sradlqdtp31saqyI53n9f_JvuibrRCbkhpq0wgIzFGmxGZpS8K6r0kzIVsm676lOU6rbPm1FWSHlG90gx5wLnmKGaVEkObayrTDnXKEshGQ5p0nqMRnH1ymx7rTR3s_UpLwUKDajbGn0i2cjLqpm2a531gQyHUOMTu6aeHbbzifPcj5qH_x7tKDDuHj-Yk-sOMD-3YculvcWXffech_99s5sFzu72mx8J-92cXPXzezGZgjh7KNj4ZHh8aTDMLeJshPDY0zt8rc9O_uDVGB4XKr2DI-Xwl8b_DsAAP__7yPwrQ">