[flang-commits] [flang] [Flang] Revise the fix in PR #81807 to get specific procedure from a potential generic name. (PR #81544)

via flang-commits flang-commits at lists.llvm.org
Tue Feb 13 03:37:31 PST 2024


jeanPerier wrote:

I am afraid this might be pushing the problem further and that the issue would still occur if the renaming was done on a generic. I think we cannot easily change the procedure interface symbol in semantics without risking breaking the module file generation in case of renaming.

File 1:
```
module fmod
    INTERFACE inner
      MODULE PROCEDURE  inner
    END INTERFACE
contains
  subroutine inner(n)
    print *, n
  end subroutine
end module
module fmod1
  use fmod,proc1=>inner
  procedure(proc1),pointer :: p1
end module
```

File 2:
```
Program test
  Use fmod1
  p1 => proc1
  Call p1(343)
End Program
```

Would also raise the bogus semantic errors with this patch because the generated fmod1 module file also "bypass" the renaming in its procedure statement.

I think we should instead change the approach from #80738 and deal with the fact that the interface symbol may have generic details. Maybe adding a case for `GenericDetails` in `Symbol::GetType()` would be the best approach:

https://github.com/llvm/llvm-project/blob/e79ad7bb94611666a23764459098574bc0394d56/flang/include/flang/Semantics/symbol.h#L1016

I would run that through @klausler when he is back next week though to make sure there no code out there that expect Symbol::GetType to be null for generics.


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


More information about the flang-commits mailing list