[flang-commits] [flang] [Flang] Update the fix of PR 80738 to cover generic interface inside modules (PR #81087)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Fri Feb 9 12:53:32 PST 2024


psteinfeld wrote:

This change is causing some of our tests to fail.  Here's an example.  I have two files that are compiled separately.  Here's the first file:
```
module fmod
contains
  subroutine inner(n)
    print *, n
  end subroutine
end module
module fmod1
  use fmod,proc1=>inner
  procedure(proc1),pointer :: p1
end module
```
I then compile this file with `flang-new -c first.f90`.  Here's the second file:
```
Program test
  Use fmod1
  p1 => proc1
  Call p1(343)
End Program
```
I then compile this file with `flang-new main.f90 first.o`.  I expect this to not produce errors.  But I get the following output:
```
error: Semantic errors in main.f90
./main.f90:3:3: error: 'inner' is not a procedure
    p1 => proc1
    ^^^^^^^^^^^
./main.f90:3:3: error: In assignment to object pointer 'p1', the target 'inner' is a procedure designator
    p1 => proc1
    ^^^^^^^^^^^
./fmod1.mod:4:27: Declaration of 'p1'
  procedure(inner),pointer::p1
                            ^^
./main.f90:4:3: error: 'inner' is not a procedure
    Call p1(343)
    ^^^^^^^^^^^^
./fmod1.mod:4:11: error: 'inner' must be an abstract interface or a procedure with an explicit interface
  procedure(inner),pointer::p1
            ^^^^^
```
Weirdly, if I concatenate these two files, everything works.

I'm planning to revert this change.  Stay tuned for that.


https://github.com/llvm/llvm-project/pull/81087


More information about the flang-commits mailing list