<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93845>93845</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnose on NULL(mold) being actual arg to `same_type_as` and `extends_type_of`
</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 code
```
type dt
real :: r1
end type
logical :: res
type(dt), pointer :: a, b
res = same_type_as(null(a), b)
res = extends_type_of(null(a), b)
end
```
Flang currently issues errors as:
```
./tt.f:6:20: error: A NULL() pointer is not allowed for 'a=' intrinsic argument
res = same_type_as(null(a), b)
^^^^^^^
./tt.f:7:23: error: A NULL() pointer is not allowed for 'a=' intrinsic argument
res = extends_type_of(null(a), b)
^^^^^^^
```
The code seems standard conforming to me.
`null(a)` returns a disassociated pointer that has the characteristics as `a`. The argument of `same_type_as` and `extends_type_of` requires it does not have an `undefined` association status. `Disassociated` is not `undefined`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VMGO4zYM_Rr6QqyhSLFjH3xIkwYosOipPS9oi7ZVyNJUkqedvy9kZ2ZnB8ECcyggRJFE0o_vkaQYzeSYO6h-gepa0JpmH7orOcP2cpnZFb3XL93Fu2g0B0wz4-it9f8YN-HgNYO4gjhDLe5rO6aXJ0ad9gNiYLII6gzqjOGw37LTmM32k_WTGd4ZcfweCGSjE8gW5AWfvHGJw6sd5bt-Nw0cEdQVIy38Lft9owiycau1IBu6B-jz_oM9_5vY6bi7-PFnLuz0w3T335ulzMkaArtkX9DEuHJEDsGHiBQz5kfeJchbSuUI6lyDOkuRM9u88p8z_v7n168gG5DtW_omovMJKQvBGkcfEOSJQF1BntC4FIyLZkAK07qweyfE5zhCqH59sD7CPmXY6v-H_Qmpfob8oXp_zLzVM0bmJWJM5DQFjYN3ow9LLvfkceES34K8_3gtMHBag4tIqE2kGP1gKLF-yz7NlHCmuDXRMFOgIXEwMZkhlwdCLQhqUWKG8koB-jE__CBYLZCcztcfCdlQ_L2aTJhJqD3vjM_0zEguu6xO82gc6y3MHaXxLmec1lhmm-t7_NnuLtwH97LQndKtaqng7nA6nETTVG1bzN1xGAVzW_enQVey0k2lKzpWlTw1x_6oVWE6KeRRVEocTkId2lK2qha1FKPiSmlmOApeyNjS2uel9GEqtnbqWtUcq8JSzzZuU0vKfp1ASpAXkHLMPQjqPAbvMjX5oboWocthvvTrFOEorIkpfg-cTLLbBNwaGKor_uYGHwIPCbWhyfnI6N1rQS_e6lzUPeeaoCGtZLNcuTw-o1SxBtvNKT1tg0HeQN4mk-a1Lwe_gLxlfPfty1Pwf_GQQN72oQLythPx3Mn_AgAA___80cC6">