<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124976>124976</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Missing compile-time diagnostic on different declare type of SOURCE and PAD argument of intrinsic RESHAPE
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code:
```
program main
type Base
integer :: i = 88
end type
type, extends(Base) :: Child
integer :: j = 99
end type
type(Child) :: c1(10)
type(Child) :: c2(3,5)
class(Base), allocatable :: b1(:)
c1 = (/ (Child(i,i+100), i=1,10) /)
allocate(Child::b1(2))
c2 = reshape(c1, (/3,5/), b1, (/2,1/))
end
```
Flang is issue an error as
```
error: loc("t.f":17:5): 'hlfir.reshape' op ARRAY and PAD must be of the same type
error: verification of lowering to FIR failed
```
While the complain is correct as the standard requires SOURCE and PAD to have the same declare and dynamic type, it should be a semantic checking rather than in FIR.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVE2PpDYQ_TXmUpqWKWAaDhwYelByiLLqVRTlaEwB3hi7Y7tnM_9-ZQ_TPRqttAiJj6p679WHS3ivFkPUsuqJVadMXMNqXXsSRpHu-5VMNtrpte2t8WoiB2ElmK3W9rsyC0g7ESs6xjv2yPebdxdnFyc22IQyjHcAAOH1QvAkPO3f8VIm0EIOACJE0YECVpygrncfMlOKi-h3FIY90P-BzOQZ1gkSm3eEflV6-gnFbv6WCJrmFwT1G8wdVuYM65wzbH7hhwzrgmFf7a5SC_9BZtQutLZSBDFqeg8bI3x8T0E7hcyT2GjBAe5ktWLYK4ZPOec7pGLFKWfYJ4XAcLgL3dnuYhNjIsQU_ZERE6Mjv4qUXky73xXsWQ075fjBhJH63RTxyEyfJoLxbtDCLKA8KO-vBMIAOWcdCP_JN_2OZdFWJgIMh5khsqLLj6zoUm2LDhgeVz0rd7gJPoK9QHc-d_-AMBN86U6wXX2AkcDOaXK92Oi95TeeF3JqVlIEZU101PY7uTjdwcLw-xlmoTT9JKO_V6UpwUq7XbRQJqYnrXMkAwj_xhiEmYSbwNF_V-XIw9c__zr3zzeFwcIqXugubyKphaPkML0asSl5G3wVwK_2qqeYkwBPmzBBSZAryX-jZCfCmk6pMKBMlH_IpraYmqIRGbX5sajzmjc1z9a2bI7HsZrKeeZj2WD9OPOSy7HgoqgRc8xUixwrnmODnGPVHGQzNuVYP-b5XFVYlqzktAmlD1q_bAfrliw1t82xbI6PmRYjaZ9WC-Ic-8-KbnbWxNMbO1qdMtfG2IfxunhWcq188He0oIJOqykND6tO8Ify_m3xbBel6SGoWDElFmN9LIQ1MKl5Jkcm3CqZlo-dP1deuOW6RT87x0XhlPFKwvn562_dl-fs6nS7hnDx6WAODIdFhfU6HqTdGA5R4_54uDj7jWRgOKT0PcNhr8BLiz8CAAD__16DlKU">