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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation error when the name of procedure-entity-name in procedure declaration statement are the same as generic-name specified in INTERFACE statement
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 20.0.0(357bd61744bb8cc2b9b07447294fa977e5758550/AArch64
```

When the name of `procedure-entity-name` in `procedure declaration statement` is the same as `generic-name` specified in `INTERFACE` statement, a compilation-time error occurs.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

snggx416_.f90:
```fortran
module m1
  interface
 integer function ext(dmy)
       integer :: dmy
     end function ext
  end interface
  procedure(ext),pointer :: gnr
  interface gnr
     procedure :: gnr
  end interface gnr
end module m1

program main
  use m1
  gnr=> ext
  if (gnr(1)/=1) print *,101,gnr(1)
  if (ext(1)/=1) print *,102,ext(1)
  print *,'pass'
end program main

integer function ext(dmy)
  integer :: dmy
  ext=dmy
end function ext
```

```
$ flang-new snggx416_.f90
error: Semantic errors in snggx416_.f90
./snggx416_.f90:8:13: error: 'gnr' is already declared in this scoping unit
    interface gnr
 ^^^
./snggx416_.f90:7:29: Previous declaration of 'gnr'
 procedure(ext),pointer :: gnr
 ^^^
./snggx416_.f90:15:3: error: 'gnr' is not a specific procedure
 gnr=> ext
    ^^^
./snggx416_.f90:16:7: error: Cannot call subroutine 'gnr' like a function
    if (gnr(1)/=1) print *,101,gnr(1)
 ^^^
./snggx416_.f90:7:29: Declaration of 'gnr'
 procedure(ext),pointer :: gnr
 ^^^
./snggx416_.f90:16:7: error: No specific function of generic 'gnr' matches the actual arguments
    if (gnr(1)/=1) print *,101,gnr(1)
 ^^^^^^
./snggx416_.f90:16:30: error: Cannot call subroutine 'gnr' like a function
    if (gnr(1)/=1) print *,101,gnr(1)
 ^^^
./snggx416_.f90:7:29: Declaration of 'gnr'
 procedure(ext),pointer :: gnr
 ^^^
./snggx416_.f90:16:30: error: No specific function of generic 'gnr' matches the actual arguments
    if (gnr(1)/=1) print *,101,gnr(1)
 ^^^^^^
$
```

```
$ gfortran snggx416_.f90; ./a.out
 pass
$
```

```
$ ifort -diag-disable=10448 snggx416_.f90; ./a.out
 pass
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV9-PozYQ_mucFyuRM0CABx64ZKn6cqraU_tYGTOAr2BHttkf_31lIAnJ5rZ711OlSrdC7GKPv8_zjWc8y62VjULMSPSBRIcVH1yrTaZbpdf151Wpq5eM7Nj8sANh-e9orNSK6prWHVfNWuETJUFOgW3YhhFIgiguq902DsOyTISAMi1ZHIYxpGHN0zjGKI6SKGIEijw3ot2FE_IN0fT-o0VFXYtU8R49Kdmxo9ECq8HgGpWT7mXt58iOUamupmmFouOGO79f67jDHpUbDe2IaT0mt35RgwqNFGcoe0Qha4nVDPrzx08Pvxb5_mGcPGPBnnIqdH-U3UizdrJHisZoQ7UQg7GbpTefWqS17jr9JFVDucFxGw6to0ejG8N7j1icdPUfP9XaOMMV5aqi0n8s-QgU-IxiGF00aIfOXRFa1TTP4Xb356ZOGQnyG6Vn7Gm019XQIe230yelUjk0NRc4D_jvBg2tByVGQnx2BJKqfyGQnhaNPydLzxjk1FtcplFV1xDzlB-_paTnYBJIRrqUwP6oR7sTfKPMqy0vB-kC5s6aK97LhB--kWR6z5GiPZfqhDHYpXAeIziQ4GHpnqwpgcRPQbId_ShIcPB_0aORylECOYH9lm0J7BdmV8snxd9cDgT2C7OzjhcbAvGRW0sgvnj62qnp_a6Yfznc3jo4nAfuh_5u4t8OQrioN9fHeoL2OefZf8OeKyfFlIXW5-8d8w2B4jY5EhLk28BjnMEIxGMoYl8yeGeQVy9zWZlKg2ul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