Skip to content

fort_depend 2.0.0 crashes when module not defined #21

@lackyO3

Description

@lackyO3

This program:

program FortDependPrecompiledProg
  use ISO_FORTRAN_ENV
end program FortDependPrecompiledProg

produces this behavior:

/tis/releases/daniel.kahn/python-science/0.0.9/bin/fortdepend -f ~/TestFortran/TestFortDependProg.f90 -o TestDepend -w
Error module ISO_FORTRAN_ENV not defined in any files. Creating empty
Error module ISO_FORTRAN_ENV not defined in any files. Skipping...
Error module ISO_FORTRAN_ENV not defined in any files. Skipping...
Traceback (most recent call last):
  File "/tis/releases/daniel.kahn/python-science/0.0.9/bin/fortdepend", line 8, in <module>
    sys.exit(main())
  File "/tis/releases/daniel.kahn/python-science/0.0.9/lib/python3.8/site-packages/fortdepend/__main__.py", line 78, in main
    project.write_depends(filename=output, overwrite=args.overwrite, build=build,
  File "/tis/releases/daniel.kahn/python-science/0.0.9/lib/python3.8/site-packages/fortdepend/fort_depend.py", line 283, in write_depends
    program_deps = self.get_all_used_files(program)
  File "/tis/releases/daniel.kahn/python-science/0.0.9/lib/python3.8/site-packages/fortdepend/fort_depend.py", line 206, in get_all_used_files
    used_files = [self.modules[module].source_file.filename for module in used_modules]
  File "/tis/releases/daniel.kahn/python-science/0.0.9/lib/python3.8/site-packages/fortdepend/fort_depend.py", line 206, in <listcomp>
    used_files = [self.modules[module].source_file.filename for module in used_modules]
KeyError: 'ISO_FORTRAN_ENV'

Listing the offending module names after -i suppresses the errors and the crash, but I don't think it should crash without -i.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions