<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128608>128608</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when using the type is statement in select type construct
</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 : 21.0.0(f75126eeabba13ce2aab53c2e4296fca12b9da0d)/AArch64
```
In the attached program, the `type is` statement is defined in `select type` construct, and the type of variable `x` is treated as `integer` instead of `polyphasic` in subsequent blocks.
This is mentioned in `Fortran standard 2023: 11.1.11.2 Execution of the SELECT TYPE construct`, so it seems correct that this should not result in a compilation error.
However, this program results in compilation error in Flang.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
sngtatm013_2.f90:
```fortran
subroutine ss2
class(*),allocatable::x(:)
allocate(x,source=[1])
select type(x)
type is(integer)
do concurrent(ii=1:10000:1,.true.)
x(ii)=ii
end do
end select
end subroutine ss2
```
```
$ flang -c sngtatm013_2.f90
error: Semantic errors in sngtatm013_2.f90
./sngtatm013_2.f90:7:9: error: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT
x(ii)=ii
^^^^^
./sngtatm013_2.f90:2:25: Declaration of 'x'
class(*),allocatable::x(:)
^
$
```
```
$ gfortran -c sngtatm013_2.f90
$
```
```
$ ifx -c sngtatm013_2.f90
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVUuP2zYQ_jX0ZbACNbJk--CD4kdboEiKZFugp4KiRhZTmXRJatf774uhtLtONkEfgmxJnAe_mflmqEIwJ0u0FeU7Ue4Xaoy981vXW3fXfV40rn3aikrOt6x_Ix-Ms-A66AZlTyCKGjDPZCYFrrtVmWNFpJpG5YUmVKopC420xE3VaZVjs2mVbAVuBB7r2uu-WgpZ3-4gZP2ThdgTqBiV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