Skip to content

Fortran: Fix suprious dependencies with submodules

Vitaly Mogulian requested to merge vitmog/cmake:fortran-module-dep into master

In commit 695f0d0d we created keyword-specific variants of the original USE WORD other EOSTMT production, such as MODULE WORD other EOSTMT and INTERFACE WORD other EOSTMT. The same pattern was used by more keyword-specific productions in !91 (merged).

The postfix part (other) of several keyword-specific productions is not needed to match Fortran syntax. See the Fortran 2018 standard, para.4.1.4/1 on p.28, para.14.2.1/2 on pp.293-294. The postfix is needed only for a case of operator 'use':

use <module-name> [, only : <list-of-vars>]

The unnecessary postfix matching from the keyword-specific productions such as module, submodule, and interface declarations can cause spurious module dependencies to be detected, so remove it.

Extend the test suite with examples covering the previously-broken cases.

Fixes: #18427 (closed)

Edited by Brad King

Merge request reports