Some preprocessor patterns break fortran dependency scanning
I wrote a simple reproducer program; it can be acquired here: https://github.com/jgfouca/f90_dep_bug
The broken file contains:
module ice_flux implicit none save real, dimension (1,2,3) :: & daidtd , & dvidtd ! The presence of this segment breaks the detection of the ice_state dependency real, dimension(1,2,3) :: & #ifdef FOO baz, & #endif #ifdef BAR bla, & #endif goo ! end broken segment contains subroutine init_history_dyn use ice_state, only: aice, vice daidtd (:,:,:) = aice(:,:,:) dvidtd (:,:,:) = vice(:,:,:) end subroutine init_history_dyn end module ice_flux
With this code, the dependency on ice_state is missed. If either (or both) of the FOO or BAR ifdefs are removed, the dependency is found. If the 'use ice_state' statement is moved to before the ifdefs, the dependency is found.
This issue looks somewhat similar to #18188 but is a bit different since the ifdefs are removed from the use statement.