<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98981>98981</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] No error checking when array intrinsic assignment uses an array of derived type with a different shape
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:runtime
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 19.0.0(73447a3302541c343525570222b318e7f94f9402)/AArch64
```
When `array intrinsic assignment` uses an array of `derived type` with a different shape, no compilation-time error message is outputted. (vcommta_22.f90)
When `derived type` is changed to `integer type`, an error is detected and a compilation-time error message is outputted. (vcommta_42.f90)
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
vcommta_22.f90:
```fortran
program main
type t
integer i1
end type t
type(t),allocatable::b(:)
allocate(b(10))
b%i1=1
b(1:10)=b(10:1)
print*,b(1)%i1
deallocate(b)
end program main
```
```
$ flang-new vcommta_22.f90; ./a.out
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/CHMK23/vcommta_22.f90:8): Assign: mismatching element counts in array assignment (to 10, from 0)
Aborted (core dumped)
$
```
```
$ gfortran vcommta_22.f90; ./a.out
vcommta_22.f90:8:2:
8 | b(1:10)=b(10:1)
| 1
Error: Different shape for array assignment at (1) on dimension 1 (10 and 0)
$
```
```
$ ifort -diag-disable=10448 vcommta_22.f90; ./a.out
vcommta_22.f90(8): error #6366: The shapes of the array expressions do not conform. [B]
b(1:10)=b(10:1)
--^
compilation aborted for vcommta_22.f90 (code 1)
$
```
vcommta_42.f90:
```fortran
program main
integer,allocatable::b(:)
allocate(b(10))
b=1
b(1:10)=b(10:1)
print*,b(1)
deallocate(b)
end program main
```
```
$ flang-new vcommta_42.f90
error: Semantic errors in vcommta_42.f90
./vcommta_42.f90:5:3: error: Dimension 1 of left-hand side has extent 10, but right-hand side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