<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148255>148255</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Inconsistent behavior with allocating a zero-sized array
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:runtime
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code:
```
real, allocatable :: r1(:)
allocate(r1(0))
print*, allocated(r1)
allocate(r1, source=[real:: ])
print*, allocated(r1)
end
```
Flang outputs
```
> a.out
F
T
```
Both ALLOCATE statement allocate a zero-sized array, so the output should be consistent.
Since the standard allows allocating a zero-sized array, the result of calling ALLOCATED should be `T`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMUs1q4zAQfhr5MtTIUuQ6Bx_cpIaFwh62LyBb41iLIgVp3NI-_SI73ZZQlgWRGOb7mW9mdEr25BFbph6YOhZ6oTnE9qi9RXc4zOiLIZi39hB8sgYj0IwwBefCq_UnGINBJjvG11fz6-NdRO2YOIB2Loya9OAQMlB2ECsmmvwt9hvvikEmmrXGc2UtXqL1xET3RQnNFfY9-QApLHFEJo9MPaxdbK5MHf9bE725idM77U8QFroslG5qTD6CLsNCjHfQ55_nWwTvHgLN0D09_Tx0z4-QSBOe0dPfDkDDO8Zwl-w7GtAx6rctzDrwzRjSHBZnYEAY8zoSoacSGO9-WT_iikykvdHRrMKv6UM_7-p7h0yKmBZHECYYtXMZ-9Hp8Ysnq_kzq3m5BSpMK81e7nWBbXWvhNjtm6op5lbuZV1PzdAMtTDjaKTkk0KuplFyNcixsK3gQvH7qqpqLmVdTnWj5KR0rTXnu2pgO45nbV3p3Mu5DPFU2JQWbKtdI5QqnB7QpfVghZjyYpjs4uLJnpEJka84tpl6NyynxHbc2UTpU4wsufXeN646wg__OU8YcNYvNkR4tTT_e37FEl07E13Ses49E_3J0rwM5RjOTPTZ8vp3d4nhN47ERL-GSUz01zwvrfgTAAD__2_mF0E">