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

Units that have not been opened #204

Open
Beliavsky opened this issue Dec 7, 2024 · 2 comments
Open

Units that have not been opened #204

Beliavsky opened this issue Dec 7, 2024 · 2 comments
Labels
rule A new rule for the linter

Comments

@Beliavsky
Copy link

Fortitude is silent about

implicit none
write (10, *) "hello"
end

and some compilers will execute this code by writing to a file fort.10, but the standard does not mandate this, and I suggest that fortitude warn about writing to units that have not been explicitly connected to files.

@ZedThree ZedThree added the rule A new rule for the linter label Dec 7, 2024
@ZedThree
Copy link
Member

I think this is a really good idea in principle, but I suspect actually tricky to pull off. It's entirely possible that the unit might have been opened in a completely different translation unit. Even just opening it in a different procedure (which I do see in practice) would mean needing to reason about the execution order of those procedures -- even worse if there are any conditionals or control flow involved.

This almost certainly requires more in-depth static analysis than we're currently set up to do, but if we had that, we'd be able to do some very interesting checks.

@Beliavsky
Copy link
Author

Beliavsky commented Dec 10, 2024

I see your point. Maybe have an option to warn that unit 10 may not have been opened in the current program unit, and let the programmer decide if there is a bug or reliance on non-standard behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule A new rule for the linter
Projects
None yet
Development

No branches or pull requests

2 participants