This is an archive of the discontinued LLVM Phabricator instance.

[flang] Implement checks for defined input/output procedures
ClosedPublic

Authored by PeteSteinfeld on May 24 2021, 1:32 PM.

Details

Summary

Defined input/output procedures are specified in 12.6.4.8. There are different
versions for read versus write and formatted versus unformatted, but they all
share the same basic set of dummy arguments.

I added several checking functions to check-declarations.cpp along with a test.

In the process of implementing this, I noticed and fixed a typo in
.../lib/Evaluate/characteristics.cpp.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.May 24 2021, 1:32 PM
PeteSteinfeld requested review of this revision.May 24 2021, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2021, 1:32 PM
PeteSteinfeld added a project: Restricted Project.
klausler accepted this revision.May 25 2021, 10:48 AM

Looks really good; thanks for figuring all of this out from the standard.

flang/lib/Semantics/check-declarations.cpp
1039

Consider having one call to CheckDefinedIoProc() and using two std::visit() calls to calculate its last two arguments.

1742

Should be nested in the else, I think.

This revision is now accepted and ready to land.May 25 2021, 10:48 AM
PeteSteinfeld added inline comments.May 25 2021, 1:26 PM
flang/lib/Semantics/check-declarations.cpp
1039

Good suggestion. All of the information is actually inherent in the value of GenericKind::DefinedIo, so I can get everything I need by just passing io to CheckDefinedIoProc(). That simplifies things a lot.

This revision was landed with ongoing or failed builds.May 25 2021, 1:41 PM
This revision was automatically updated to reflect the committed changes.