<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/163242>163242</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Unnecessary diagnostic on zero-length character object
</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:
```
character(0), allocatable :: ch
allocate(character(-1) :: ch)
end
```
Flang diagnoses this case with
```
error: Semantic errors in t.f
./t.f:2:27: error: Character length of allocatable object in ALLOCATE must be the same as the type-spec
allocate(character(-1) :: ch)
^^
```
Because both of the `type-spec` at the declaration and the allocate statement specify zero-length, the diagnostic message seems unnecessary.
All, gfortran, ifort and XLF don't diagnose this case.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUU09vuzgQ_TTmMgoydkLCgYObllOlPeyutNfBDOCVsSPbtMp--pVJ2uTX208yYjSaN3_evMEYzeSIWnZ4YYfXAtc0-9C-ojNkz-eZXNH74dqevYtmoABpJhi9tf7TuAm0H4hJxbhiNb8_rvSMAXWiwMSJM9EwcQa01mtM2FuCjJAK9My4uvuJidMzbFcx0TwFioZxRW74UYlx1Vl0EwwGJ-cjRUiziaAxEnyaNP-IpxB8yCn_pAVdMho2TwTjIJUj46pkosuWVCJ_xxz8jTp_dQiW3JRm8OMvg_n-X9IpJ1Pv73-c1V9vsKwxQU8bbxEXAoybna4X2sULacYV_A4JwA5v-fGfrDOuXkjjGgl6f-stF2I1f9SqOWDa3ANpiwGT8Q7QDZvvqw2ICRMt5BJklBmv8B8Fv7sNnbe5ZbhRnklcKEacCCLREmF1jnT2hGvJuFLWZsg0-pACumybbG9l_3nvYPCOiWP63uFjhWUxtHJoZIMFtdWx5vIkqmZfzO2xqkYxSj4c90LqSlC95_WhQl3L44EaLEwruDhUvJJVw2W1L0XNT0hIsu55JY_E9pwWNLa09mMpfZgKE-NKbVVLsReFxZ5s3M5CiDFrjEk1Bu9SVqEQ-VhCm7G7fp0i23NrYoqPbMkku53VDXx4hb8fvDyT590zu_AtgLuaijXYdk7pErMQRMdEN5k0r32p_cJElwvef7tL8BnCRLfNEpno7uN8tOL_AAAA__9pEj6O">