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

    <tr>
        <th>Summary</th>
        <td>
            Invalid semantic error with external dummy procedures
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          daniel-otero
      </td>
    </tr>
</table>

<pre>
    The following reduced snippet, doesn't compile with `flang-new` but it runs [correctly on GNU and Intel compilers](https://godbolt.org/z/GPYK79Tb1):

```Fortran
module mod
    interface
        module subroutine doall(f)
 external f
        end subroutine
    end interface
end module

submodule (mod) doall_sub
    contains
        module subroutine doall(f)
            external f
            call f(34)
 end subroutine
end submodule

 program test
    use mod
 call doall(sprint)
    contains
        subroutine sprint(i)
 integer :: i
            print*,i
        end subroutine
end program
```

The reported error:

```
error: Semantic errors in test.f90
./test.f90:11:33: error: Dummy procedure 'f' does not match the corresponding argument in the interface body
          module subroutine doall(f)
 ^
./test.f90:3:33: Declaration of 'f'
          module subroutine doall(f)
                                  ^
```

Tested with `flang-new version 20.0.0git (https://github.com/llvm/llvm-project 32ffc9fdc2cd422c88c926b862adb3de726e3888)`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU2P4zYM_TXKhZhAoeLYPviQ3TSLRYGiQLeHngpZoh0VsmRI8kynv76Q43zMx2LbEYIEoUm-9yiSljGa3hE1rPjEisNKTunkQ6OlM2QffKLgV63Xz823E0HnrfVPxvUQSE-KNERnxpESw8-gPUXHsEyg_DAaS_Bk0gnYjndWuv7B0RPbcWinBCZBmFwEVnxSPgRSyT6Dd_Dll99BOg1fXSJ7SRMiKw4Mq1NKY2Riz_DI8Nh73Xqb1j70DI__MDx--fWPn8v6W7thWGc3fmD88r3j58_RhxSkO1sHrydLMHh9_g8AYFyi0ElFN1M-i2uc2uCnZByB9tJahlWX0c6-9Hei4KSF7mUwOX0XeXuW7a_wsumMdU8_Tu1CgGGV6WJ9xv8zTu0tn_IuSePiB6jfne-pmBGkzXasxPZO9jvyFttbKTAG3wc5QKKYbgBTvL-HGebCMo7BuPSC6vtC7xReYipzi8uV7ilAbg2xB_NW3RK0Z_jZ_PgGs20R86rJ7vXmqQk0-pBIA4Xgw_dac8m6uMBvNEiXjDoHRTBuLtm6qxfPNcPj1SL2mw0TeyFy6DXHYRqG50xSkZ5C7p6yY1jOkwrOJxhkUidIJ4J5DOPonc7TLUM_DeTSjHqiW5dCXgWvK_efOowVP73LW1xpH0hZGWQy3oHvLmQ_BPbDc2Xz_qVRzNf1Zn3BI4WY6SFf8zXvTYK3e8mk09SulR8YHq19vPw8jMH_RSqBwK5TdacVKr1FVFWlaty11Q6lboWmEnckqqrKanZ8vdKN0LWo5YqaTYllVRRbUa9Oza4ru2pDsq6KDgWXdas4LysUusO6K-TKNMhxu-EceVlwUa85alXrst4JxSu-QbblNEhj15lfXqQrE-NEzWbDy7pcWdmSjfN7ATGrn58yxPyaCM0sqp36yLbcmpjiLU0yyVLz1T1KazTEF518rup1yeiXLRpXU7DN_6sow-PMLDI8LtQfG_w3AAD__6f-C_Q">