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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnostic on procedure pointer dummy argument
        </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
    contains

    function genF1 (i)
 procedure (real), pointer :: genF1
        integer :: i
    end function
end module

program fmisc043a
use m
    call test1(genF1(1))

    contains
    subroutine test1 (p)
 procedure(real), pointer :: p
    end subroutine
end
```

Flang is currently issue an error as
```
error: Semantic errors in t3.f
./t3.f:12:16: error: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
      call test1(genF1(1))
                 ^^^^^^^^

```

The standard explicitly allows such a usage as [24-007: 15.5.2.10]
```
If a dummy argument is a procedure pointer, the corresponding actual argument shall be a procedure pointer, a
reference to a function that returns a procedure pointer, a reference to the intrinsic function NULL, or a valid
target for the dummy pointer in a pointer assignment statement.
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVNuOozgQ_RrnpdTImBCSBx6YzkRqadQv2_sBFbsAr4yNfOnZ_vuVIdPJot4LQgm-1OWcqlMYgh4sUcvqb6w-7zDF0fn2jFaTeX4eye6uTn20z84GrchDHAl6Z4z7qe0A0iliVcd4xw789vJucioZgonxDgBAOhtR25BvrTt9sjJqZ2EgeymBiaNm4pQPZ-8kqeQpb3pCk_fFM8xO20gecrCqW-1uzvKTD4f7sb4dkVWfsRjv8nLNbU1l9m7wOEE_6SD5vkLGuxQeEkdjIFKIJRPHNaQ4lktGpzuYB3h5GdLVuxS1pdU0A5m36P4V3PyQ_d3bmv-Gaca7i0E7gA4gk_dko_kAHUIiQAvkvfOAYWO1bOdIv9GENmq5XgygLcSq6BnvCiYuy2fVlSL_HPL9T8NOxoQG0A9pIhsBQ3BSYyQFP3UcH8r4C5tK0_RxN2CimVl1ZqKBKYUIVwL8vJusoRDg5fXt--sbE8eX1xt_8D-qAtuH1d-_fvm2bxnv3kaCENEq9Aroz9loqTOlmDs-QEhyBIQUcCDAAKz-JvZPnDeZlLIu6kIUJWf1eeP5pQfcUqBDhrwlKvdD1ph03lOYnVVZZ7jhO4yZhJW0rzzkTvbUkycrCaIDvGsujhjBU0ze_mMGCH-zzglpG722Qcu7p9fff_zIt3OPwTsandszoh8oQu_WWbGC_lVZbR_KvM6eFU_ESPmr2BC3U22lTtUJd9SWTXWqjhUXfDe2B9E3h2PTNHhqyr2Sx-tJ7MuqOZ7KHiU2O90KLmouSlE2dcN5oerqKHvVC1U1SpXE9pwm1KYw5n0qnB92i27aUhxONd8ZvJIJy1wUos8iY1XXe2djlqEQeVr6Nts-XdMQ2J4bHWK4e4s6mmWuLgpl9Rle7FJVGUFpHKwLWXrO_qdadsmbdoxxDnlCiAsTl0HHMV0L6SYmLjnk7e9p9u4PkpGJy4ImMHG5AXpvxV8BAAD__30l3KI">