<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125928>125928</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnostic on `NULL(allocatable)` as actual argument for generic resolution
</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
```
module m
type Base
integer i
end type
type, extends(Base) :: Child
integer j
end type
interface printMe
subroutine printBase(b)
import Base
type(Base), pointer :: b
end subroutine
subroutine printChild(c)
import Child
type(Child), allocatable :: c
end subroutine
end interface printMe
end module
program generic002
use m
type(Base), pointer :: b1
type(Child), allocatable :: c1
allocate(b1, SOURCE=Base(10))
allocate(c1, SOURCE=Child(8, 9))
call printMe(null(b1))
call printMe(null(c1))
end
```
Flang currently issues an error as:
```
error: Semantic errors in t.f
./t.f:32:5: error: No specific subroutine of generic 'printme' matches the actual arguments
call printMe(null(c1))
^^^^^^^^^^^^^^^^^^^^^^
```
The code seems valid as `null(c1)` should have a allocatable result of the same type as `c1`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVNGuozYQ_RrzMtrImEDggQc2dyNV2m6lbvcDjD0Br4wd2ea29-8rG5KQ23RbaSOkJPaZmTNnDsO9V4NBbEn5kZQvGZ_DaF37wo1CfTyOaLLeyrf2aI1XEh2EEeFstbZ_KjOAsBIJ7UhF14d2k5WzRpgI7QAAwtsF4SP3uP6PH2UCDuhArWdoZMLFTPcowo6AfwU00hNWpxSsAVJ0pOjgOCotn6T8_jxlvHZnLhAuTpnw65aNn3tn56DMerlUqnvCmg0qFZku1oX33dz5XklG5hebal759puAyO1edGX4nsXSIKvFv9J4L8GGxxqciHCtreCB9xqvZMSPyFwPn0kWz5f5Lqwvzg6OTzCgQacEpYzQbvaP0_-xLnlE_k_a-d0g63UaVB7xX3_79vvxEyle1vHlNCVK2m3A4hF8VbmOp80tYi0iuNa37lltZq3Xes19Ks9B4g5CI5eU27eE0O6keXyDZufQBP0GyvsZPXAD6Jx1wH3s-zEs3UQtvuLETVBiwXpQBsLuTGi3I-wUfxVdwUjRlRF8i_piwV9QqLMSW8PZ83WCQNgh9TIhYQeYeBAj-vTScxFmroG7YZ7QBH_z0H8KsMBI-elnn39I-MeIaQWBR5w8vHKtJHAPpKIPNCoKfrSzljDyVwT-4C6HftYhihDb9HzCZWkteUROKrrLZFvIpmh4hm1-KOpDXTNWZ2PLWV3RqilkjgWTh0MtMZd11RRNw0Re1ZlqGWUlZbRkdF_s613VR2ze07Kn9MD3ZE9x4krvtH6ddtYNWTJCm7OyYXWmeY_ap_XM2DlahhTd2VkTFyNhLC5t18bYD_08eLKnWvng79mCCjqt9-Q3Ur7AL0ZY51AEkIoPxvroI2tit1--ff5MWL2RZ5WP-_cGgLN1N9s49FbPQVmTzU63YwiX5F52Iuw0qDDO_U7YibBT5LV-fbg4-x1FIOy0eJ-w09r1a8v-DgAA__-pj_VY">