<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/88747>88747</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnose in structure constructor for array component
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            flang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          DanielCChen
      </td>
    </tr>
</table>

<pre>
    Consider the following test case
```
use, intrinsic :: iso_c_binding
type dt
  type(c_ptr) :: a(5)
end type
integer, target :: k
type(dt) :: x
x = dt(c_loc(k))
end
```

Flang currently issues an error as:
```
./t.f:7:8: error: Scalar value cannot be expanded to shape of array component 'a'
  x = dt(c_loc(k))
         ^^^^^^^^
./t.f:3:16: Declaration of 'a'
  type(c_ptr) :: a(5)
 ^

```

It compiles the code fine if the type of `a` is intrinsic type as well as the corresponding argument to the structure constructor.
XLF, ifort and gfortran all accept the above code.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGO4zYM_Rr6Qmxgy46dHHxIkxpYoLdeehvQMu2oq0iGRM_O_H0heac7HQzaBkIkWiTfI_1oitEsjrmH4y9wvBW0yd2H_kbOsL1e7-yK0U-v_dW7aCYOKHfG2Vvrvxu3oHAU1BQZyhuUF2jLHyubW2RQVzROgnHRaIT6AvUFTfRP-mk0bjJu2V3ldWWcZDcQkwnqpJ9WCaDOb4EE6nQEdd7d2E27Y7aME144JEChsLC8BX37iQDqNMm7fC_71QtCfUvoCdF6Der0LaG8A_q0vv1_sOQW1FsI7MS-oolx44jkkEPwASkmtM_iD6AGOcxQXzqoL6fEKIekw--aLAV8JrsxanLOC46M_LKSm3hC8RjvtDL6GSkEekXtH6t37ARBdQSqe2vmf5WHbz84_vr5-sC2hvpStYnljbWlQGK8S0Q-AP-vt4h_A_xLj79KLs9YjlmB2k-Ms3GMZs4Psn4Sg7YkaEs08Z3s8iVF_M7Wpn3PEALH1WcNIoVle6TWic-3UcKmZQvJz-2GD4edyx-_DVnVsw-C5CZc0imQQ0rpteZVchIa_fNO9VBMfT2d6zMV3FddVVfn-qyq4t6rhqapLis9Uj2Vo67mseGxbbuuo6amrjC9KlVTNtWxOlaqrA4dUznqVldje26onaEp-UHGHqx9fhx8WIoswP506pqusDSyjXm6lRq3BZQCdQWl5qRaqC9z8E6SwJVK8x_6lObLuC0RmtKaKPFnYjFi85ciSx6ON_zqch-14GRocT4yGvd593BOs_BPpRZbsP1dZM0jogZQw2Lkvo0H7R-ghoT8Y_uyBv8nawE17AMGasgl_hUAAP__WSVwNg">