Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module inlining a public routine results in uncompilable code if there is a wildcard import. #2846

Open
arporter opened this issue Jan 13, 2025 · 2 comments
Labels
bug NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH

Comments

@arporter
Copy link
Member

If we have a module that does use my_mod and contains a routine that calls my_sub and then we "module inline" my_sub into that module then we get un-compilable code:

module my_mod
    public
contains
    subroutine my_sub
    end subroutine my_sub
end module my_mod

and

module caller_mod
  use my_mod
contains
  subroutine other_sub
    call my_sub()
  end subroutine
end module caller_mod

This is because the compiler then has two routines named my_sub in scope.

We can spot this situation by checking for a 'wildcard' import from the module containing the routine being inlined.
We could potentially solve it by adding a renaming to the import of the original routine symbol.

@arporter arporter added bug NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH labels Jan 13, 2025
@arporter
Copy link
Member Author

USE B, T1 => C

@arporter
Copy link
Member Author

Unfortunately, even the PSyIR fparser2 frontend doesn't support this form :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH
Projects
None yet
Development

No branches or pull requests

1 participant