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

    <tr>
        <th>Summary</th>
        <td>
            [flang] renamed specific shadowed by generic cause error when reading module files
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            flang:semantics
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          jeanPerier
      </td>
    </tr>
</table>

<pre>
    Reproducer:

modules.f90 :
```
module mod0
    interface proc
      module procedure proc
    end interface
contains
  subroutine proc(n)
    print *, n
  end subroutine
end module
module mod1
  use mod0,renamed_proc=>proc
  procedure(renamed_proc),pointer :: p
end module
```

main.f90 :

```
  use mod1
  p => renamed_proc
  call p(343)
end program
```

```
flang-new -c modules.f90
flang-new -c main.f90
```

Bogus error:
```
error: Semantic errors in main.f90
./main.f90:2:3: error: 'proc' is not a procedure
    p => renamed_proc
 ^^^^^^^^^^^^^^^^^
./main.f90:2:3: error: In assignment to object pointer 'p', the target 'proc' is a procedure designator
    p => renamed_proc
 ^^^^^^^^^^^^^^^^^
./mod1.mod:5:26: Declaration of 'p'
 procedure(proc),pointer::p
                           ^
./main.f90:3:3: error: 'proc' is not a procedure
    call p(343)
 ^^^^^^^^^^^
./mod1.mod:5:11: error: 'proc' must be an abstract interface or a procedure with an explicit interface
 procedure(proc),pointer::p
```


This test is derived from discussions in https://github.com/llvm/llvm-project/pull/81544 and was not fixed by https://github.com/llvm/llvm-project/pull/82837.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU-Po7gT_TTmUurI2BDgwCHTmUi_20-7e18ZuwCPwEa2mcx8-5WB_OlsujU9h42QI5Wryu-9qrKF97oziDXJv5D8mIg59NbV31CY_6PT6JLGqp_1Hzg5q2aJjvADoUdCt3W0ah7Q79qKwm1rT7fvzgdGqzYDAIA2AV0rJMLkrLzZATb3aEY1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