<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56140>56140</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Assertion failure in lowering for Reshape Intrinsic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kiranchandramohan
</td>
</tr>
</table>
<pre>
An assertion failure is seen when particular type of inputs and outputs are present for the Reshape intrinsic.
Assertion (originally seen in cam4)
```
IntrinsicCall.cpp:3138: fir::ExtendedValue IntrinsicLibrary::genReshape(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>): Assertion `resultRank[0] != fir::SequenceType::getUnknownExtent() && "shape arg must have constant size"' failed
```
Reproducer
```
subroutine simple(n)
integer :: n
real(kind=8), pointer :: v2d(:,:)
real(kind=8), allocatable :: tmp(:)
integer :: dims(3)
allocate(tmp(n))
v2d(:,:) = reshape(tmp, dims(1:2))
end subroutine
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9VMuu2jAQ_ZpkYxUlDgRYZJHCRarUFX3sHWdIXBw79eNS-vUdOwRQ720lyxN7Zs6ceTiNbq9VrQizFowTWpETE9IbIMISC6DIpcdtZKjkXjJD3HUEok9EqNE7S5hqifZu-ka30YAF5chJo2kP5Ai2Z-ghlDNCWcEXSbZPsnra63vYhG60EZ1QTMrrFFkowtmwTOj25lJmtxWPn2bEHbos-DgmRV3kxQYFOQmDAtfLLweqhfY7kx7I3eWzaAwz18mmA3VjiSQGObt-vYaLHZHydZhuamPY9QinpNi9HyApXgJbJPCUWJlhSbx0R6bOyepjlqz2mG2eFPsHzS_w04PiEGPeSLlv6qz0RcUIDqkhNDqWuFDQqazMdGTw1pGevQLhWlnHsPpW_EbuNKHr2E9oybslPMJodOs5mHfV1jcGeysUIOAwylAfdW8HCT2FDgyZGBM13xtgEk3PQrWYZeAd6jjqYH-3fqVtyAkPdBf37f_dscmaM8caCTOEG8YZ4l-cSCsGi0bFk8kNKWQzIcScHvq3zEholrnPSPTazdDYyZo-I-A8kEfp_qps2lZFuy22LHXCSahwIg6SqS5MRf32ESoi9QVwaLv4oubXdB_k1BtZ9c6NNjI94OqE632z4HrAQxzeSXzAXv8AjpN0ENZ6QO6HVZkvs7Sv1jnnm_W2WDG65pyX2yzL6Im1rIQ8zzc0lawBaQNbHCsFFxIhwoit9qmoaEZpVtI8p5QWdLFZt1m-zEtWZvmp5KtkmcGAKS0Cj4U2XWqqSKnxnUWlFNbZhxJ_RqJTEIsT8Jl3vTbVWRimeI9_HMMGjTKNJKqYxB-NhXbc">