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

Contained subroutines ignored, and another program with same name is added as dependency #390

Open
2 tasks
hiker opened this issue Feb 19, 2025 · 0 comments
Open
2 tasks
Labels
bug Something isn't working

Comments

@hiker
Copy link
Collaborator

hiker commented Feb 19, 2025

A recent update to LFRic caused more of socrates files to be included in the build. One thing we noticed:
socrates/interface_core/socrates_bones.f90 contains a subroutine socrates_bones, which contains (as in the Fortran statement) a subroutine scale_field.

The analysis results in:

{
    "fpath": "/home/joerg/fab-workspace/lfric_atm-full-debug-mpif90-gfortran/build_output/science/socrates/interface_core/socrates_bones.f90",
    "file_hash": 622851657,
    "symbol_defs": [
        "socrates_bones"
    ],
    "symbol_deps": [
        "rad_ccf",
        "realtype_rd",
        "scale_field",
        "scale_field_1d_layer",
        "scale_field_1d_tile",
        "scale_field_surf"
    ],
    "file_deps": [],
    "program_defs": [],
    "module_defs": [
        "socrates_bones"
    ],
    "module_deps": [
        "rad_ccf",
        "realtype_rd"
    ],
    "mo_commented_file_deps": [],
    "psyclone_kernels": {},
    "cls": "AnalysedFortran"
}

So scale_field is listed as dependency, but the analysis misses the fact that scale_field is a contained subroutine. Then it finds that scale_field is also a program and add it.
It seems correct that scale_field is not listed as symbol_defs, since it's not exported (as a contained subroutine).

  • Only list symbols as symbols_deps if they are not available in the local scope.
  • Except for the top level, do not add a program as a dependency
@hiker hiker added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant