codee-com/open-catalog

[Fortran] Check for ACTION specifier in OPEN statements

Open

#76 创建于 2025年3月17日

在 GitHub 查看
 (1 评论) (1 反应) (0 负责人)Fortran (12 fork)auto 404
Fortrangood first issuenew check

仓库指标

Star
 (105 star)
PR 合并指标
 (PR 指标待抓取)

描述

The OPEN statement allows the ACTION specifier which can be READ, WRITE, OR READWRITE, analogous to INTENT(IN), INTENT(OUT), and INTENT(INOUT) respectively. The programmer knows how an opened file is to be used, and using a file connection in a way contrary to the ACTION will produce a runtime error. Adding a check that each OPEN includes an ACTION could therefore help reveal bugs where a file that is intended to be read-only is written to. This would improve code correctness and security.

It would be even better not to rely on the runtime error, and instead check that no WRITE statement is applied to a unit opened as ACTION='READ' and vice versa.

贡献者指南