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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnose on procedure pointer declaration using proc-interface being the procedure it is declared within.
        </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:
```
    FUNCTION foo() RESULT(ResFoo)
 PROCEDURE(foo), POINTER :: ResFoo
    END FUNCTION 
```

Flang currently issues an error:
```
./t.f:1:14: error: Procedure 'foo' is recursively defined.  Procedures in the cycle: 'foo', 'resfoo'
 FUNCTION foo() RESULT(ResFoo)
               ^^^
./t.f:2:34: error: Procedure 'resfoo' is recursively defined.  Procedures in the cycle: 'foo', 'resfoo'
        PROCEDURE(foo), POINTER :: ResFoo
 ^^^^^^
```

I can't find anything in the standard that disallow this. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0U91q8zgQfRr5Zqixx3_xhS-ySQyBJS3Z9gFkaRxrUaUgyV_J2y9yvA1dugu9WKHE6Gc055w5w71XF0PUseo3Vu0TPofJum7PjSK9201kksHKW7ezxitJDsJEMFqt7YcyFxBWEiu2LNuzbMvqbJ3LEgCgfzvtXo_PJxitZbhh2ML58Mfb768MN2fyfdxt1-sv5-fdYf92PjDcjPcD3MHL8_H0ejhDzFJsYQ36THA47R9JvoVx_-81j3Bn58gEfQPl_UweuAFyzrp_45Ay7EM6smKbx18ZIfwdAC_OCpKzI2DYLIgbUB4cidl59Yv0DSSNypBM4XHZgzKLiuImdBTvER35Mmwc-XV9p_kTEb8OVh3W-Q82yIpt8R9sPiH8L4TW8fOCP_h8JfZtyY8guGHYBBiVkcDNLUzRsytaH7iR3EkIEw8glefR1BAm5VNIZFfItmh5Ql3eZJuqrPJik0xdOxRtUWdF3Wb5mMtWtnkhyqFqBTZ1XTWJ6jDDMkPM87bCvElltilrPpZ1nok2rxtWZvTOlU61_vWeWndJFi92G6ywTDQfSPulGxGH-cIQGe4Y4hgNzIrt6KwJZGQ8qPaJ6-IzT8N88azMtPLBPx4OKuilsxf3s2oPRyOscyQiYX4x1hNYA9fP0l-tMoEcSBKaOx6UNTD7qFq887QcjlwQDBQ3o46PYBWiW-6hJOFDRb3TZHa6m0K4-lhR7Bn2FxWmeUiFfWfYR7Tr5-nq7J8kAsP-3p8M-0WWvwIAAP__FqNgtw">