<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112280>112280</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Allocation is executed even if character length of allocate-object differs from character length specified by SOURCE specifier in allocate statement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 20.0.0(7f65377880ce6a0e5eaa4cb2591b86b8c8a24ee6)/AArch64
```
Allocation is executed even if `character length` of `allocate-object` differs from `character length` specified by `SOURCE=` in `allocate` statement.
The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.
sngg310d_22.f90:
```fortran
program main
character(1),allocatable::ch
call s1(ch)
print *,'pass'
contains
subroutine s1(aaa)
character(*),allocatable::aaa
allocate(aaa,source="123",stat=i)
write(6,*) "allocated(aaa) = ", allocated(aaa)
write(6,*) "stat = ", i
end subroutine s1
end program main
```
```
$ flang-new sngg310d_22.f90; ./a.out
allocated(aaa) = T
stat = 0
pass
$
```
```
$ gfortran sngg310d_22.f90; ./a.out
allocated(aaa) = T
stat = 0
pass
$
```
```
$ ifx sngg310d_22.f90; ./a.out
allocated(aaa) = F
stat = 14
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVVuPozgT_TXmpRRkimseeMgkH9_jSruz-7oypgCPHBzZpnvm368M5NLpbq1GO1FElLqcOlVljoVzapiIapZ_YfkpErMfja3NOJld_y1qTfejZgXfvvzE-OEvsk6ZCUwPvRbTsJvoFVh6AOQxjznDquyLPC3LquKSCsEpJyEy2WK-T9qqaCtZCcyICoZ7hs3hYOVYZCv4U631edDaSOFDUeWAvpOcPXVALzSB6oEVXI7CCunJgqZp8CMreODHCi7WXNqZ9htJHxyd6nuyDnprzp8luwtJ1SvqoP0RYv747c_fj_9j6Sk41fSIvIR74elMk48feX8dCXqjtXlV0wDCEviRwJPzcLFmsOLM8AjNdYjhz_97Y70VE4ipA9V_B2nOF6WX5hk2a-9hEJbcrN-Wc9MwpAnv_kaM-z1n6eFpphv2at0YwFmozQK3QTCskmU5x61J0WoKeOlBjlswSKE1uIRhJccQvJkvVk0eGB4YHhmWF-Ecw3L1SjN5oSZ3jXVza83s1UQrkBDijvTIZoH7kE9I2dAAbivZoI7OzFZSWBtigilDDEYvPEtP6l7q1aolqVg4h1LAEK9o3Y0ZsPQEKwi89955fIwX6j4iqGsCTd3TKBZHML_f0odvyLMRs4d38925-AIxw0bEZvYbhU9aha-b_0Ydtgqw7PVa7OeYDdcz_kuJ3T-_gGJ48_4Du-Zzdkn2s-wenlFXp90-3YuI6qTEap_lmCTRWItUiDZPOBZFnpDIu65oK5GJUnZYlJIiVSPHLOFJhpimaRKXSVbyNutlyfOc71uWcToLpWOtX86xsUOknJupThLEikdatKTdcksgLkcrHOL8FNk6JOzaeXAs41o57-4QXnm9XC2LxrH8BP8i5c9SHET8ScHfyve7hDfCvar2zWaDcl_h7podzVbXo_cXFyQFG4bNoPw4t7E0Z4ZNaGf72V2sWa4RbJbxOIbNNqGXGv8JAAD__9bhGdg">