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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnose of procedure pointer withno proc-interface pointer assign to a function
        </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
```
Program main
  interface
    integer function foo()
    end
  end interface
  procedure(), pointer :: p1
  integer :: res
  p1 => foo
  res = p1()
end
```

Flang currently issues an error as
```
./t.f:8:3: error: Function pointer 'p1' associated with incompatible function designator 'foo': function results have distinct types: REAL(4) vs INTEGER(4)
    p1 => foo
    ^^^^^^^^^
./t.f:6:27: Declaration of 'p1'
    procedure(), pointer :: p1
 ^^
 ```
 
 The standard [F2018: 15.4.3.6]
 "
If proc-interface does not appear, the procedure declaration statement does not specify whether the declared procedure entities are subroutines or functions.
"

Such a procedure pointer should be able to point to a function or subroutine that doesn't require explicit interface.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVNGOqzYQ_RrzMloEJoTwwENuEqqVqqq6vT9g7AFcOTa1h93u31eGJKR7t1IlBGY8Mz5zPGdECHqwiA0rv7HynIiZRuebs7Aazek0ok06pz6ak7NBK_RAI0LvjHHv2g4gnUKWnVl2ZPvs9iy_v3s3eHGFq9B2tQBoS-h7IfFuWE0DeuhnK0k7C71zjB8YrzcftOr-g1b9nGXyTqKaPd4C-Qkmt3gBK46sOMKUP0MYtg2P4ZElB1acWXFZINyMHkO0xgRPoB6APtW8vlsjIjGz92jJfIAOYcYAwgJ67zyI8GVwynhLac-K44EVxyKiW_zjor2z86iLVxFSBSIEJ7UgVPCuaQRtpbtOgnRncCNVYbxkQW6JXCiuYt6Hg8cwGwowijcEpQNpKwnoY8IQ_b5fjr8yftgxXsNbgNffflx-uXy_WbaL-pJCAFZe_vP5VPqeFccV2hmlEV4s6Fz_KPjpsP9_689nwSfa4fb5MSIEElYJr4CV31qe5fEiIC_TXVqke1ae7xGcr6vXfkHx8uhIUA4DWEcgpgmFj6CiXh5YQT2VFUgQXtHSFhYmlLr_gPcRabyJbQ1B9ZQFLWnSsak8Qpg772bSFgO4TUkhvbXZHe36_mOWI4inXHfSwuhmo6BDELF3yK07cSG2RnH-6TygUazgLeMVgce_Zh3h_T0ZLTVtUk0T1RSqLmqRYJNX2SHndb3Lk7HBYtfLWnIhin1d1vmhKw-l6rK-LvZV1vWJbnjGdxnPqywrOM9T2e9Uqcoqz7O-q_s922V4FdqkxrxdU-eHZFFcc-BZdUiM6NCEZbpx3s1DpIOfGOd9lCkrjr13lqKiOY_zzzcxzUs3D4HtMqMDhS0xaTLLpFw0zsozvFrpvEdJoLQYrAsYu_VndqM4rfvcLvfddQj_m-pk9qYZiaaoQMZbxttB0zh3qXRXxtsI6vZ5mbz7EyUx3q7DhvF2qf6fAAAA___KmM4x">