<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115984>115984</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
             [Flang] Incorrect diagnose on NULL(mold) actual to allocatable dummy
        </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:
```
module m
    type Base
        integer i
    end type

    type, extends(Base) :: Child
        integer j
    end type
end module

program argAssociation001
use m
 type(Child), allocatable :: c

    allocate(c, SOURCE=Child(2,-2))
    call sub1(null(c))

    contains
 subroutine sub1(arg)
        type(Child), allocatable :: arg
    end subroutine
end
```

Flang issues an error as
```
t2.f:16:15: error: A null pointer may not be associated with allocatable dummy argument 'arg=' without INTENT(IN)
      call sub1(null(c))
```

The code seems conforming to me as I can't find such constraint in the standard. 
Both XLF and ifort compile the code successfully. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVE2PozgQ_TXmUuoIbEjgwCGdTKSWWr3Sbo-018IU4JGxI3_MbP79ypBZpmczmigisV31qt7zK9B7NRqillXPrDpnGMNkXXtGo0ifThOZrLP9rT1Z41VPDsJEMFit7TdlRpC2JyaOLD-z_Mj2-f27LGfbR00wrysAgHC7Ejyjp20rfZQJNJIDtW2T6ZfoO_AHBMZPQP8EMr1nvF7geAOpC3GE06R0_xj-y6_g02pt9sdyV2dHhzOgG4_eW6kwKGvyvFiPo9-orV3Va23epAZRaysxYKfpe2vyZzL3mJQqU85ff3z-8_SJifMdqOaMn574gthsaRK1Bh-7gvHaRK3X9C3mh0hrAirj7zs-ds7GoAx9T0c3foDeJP4dmZT5Qc4N_D9RH7pifV40mhGU95E8oAFyzjpA_zAl8N3AxLHYp0eVqi_h6c8RkgJwtemSHcx4A2MDdAR4vzPq4ZsK0wcOfZznW6IQZzIBGD8kOuLM-GEJtjHAy9v7p7d3xuuXt58k-q3-jwi_T7QMC3ii2aebGayb0wgFC3NqF15AomH8EGBQi6BySnE-OFQmgDLL7PmApkfX72AFfrZhgr9fL4CmBzVYF0Da-ao0LeFrzSgleT9ErW87yPpW9I1oMKO2OIii3NciL7OplbI5cL6nfS2Jyj0ORSnyHKUQDYqS6ky1POdlURQiF7zKyx2XFfKcF31diDpvkJU5zaj0Tuuv8866MVuuuC2KqqnLTGNH2i-vGs67ODKeHM44H5IdmDgOzpo02OmgOmeuTThPXRw9K3OtfPAbclBBUwusel7MxKozvBhpnSMZoFc4GusJrIG3z6-vjNezXfwMKENEnWT_nyWy6HQ7hXD1yeX8wvhlVGGK3U7amfFLqn3_ebo6-4VkYPyyupjxy53l15b_GwAA__9HgZef">