Fix module_mp_radar USE dependency invisible to CMake scanner#1218
Draft
mathomp4 wants to merge 3 commits intofeature/dbarahon/rc23_MG3from
Draft
Fix module_mp_radar USE dependency invisible to CMake scanner#1218mathomp4 wants to merge 3 commits intofeature/dbarahon/rc23_MG3from
mathomp4 wants to merge 3 commits intofeature/dbarahon/rc23_MG3from
Conversation
USE statements inside contained subroutines are not seen by CMake's Fortran module dependency scanner, only top-level USE statements are. Moving USE module_mp_radar to the module specification part of GEOSmoist_Process_Library makes the dependency explicit and ensures module_mp_radar.mod exists before Process_Library.F90 is compiled. The latent ordering issue was exposed by commit 37878b7 which added USE GEOSmoist_Process_Library to aer_actv_single_moment.F90, creating a new constraint that reshuffled compilation order and triggered the missing .mod file error in both GCC and ifort.
not() is the bitwise integer intrinsic; .not. is the logical negation operator. ifort silently accepts not() on logicals as an extension, but GCC correctly rejects it.
Open
GCC rejects array constructors with elements of different CHARACTER lengths (standard violation). 'KM' and 'RI' (length 2) were mixed with 'ALH' (length 3). Pad short strings with trailing spaces to make all elements length 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had Claude try and figure this out. This was a thought it had...
Problem
GCC and ifort fail to compile several files due to standard violations that ifort accepted silently as non-standard extensions.
Fix 1 —
Process_Library.F90: hoistUSE module_mp_radarto module levelGCC:
Fatal Error: Cannot open module file 'module_mp_radar.mod' for readingifort:
error #6404: This name does not have a type [XAM_R]Root cause: CMake's Fortran module dependency scanner only reads
USEstatements at the module/program specification part (top level). It does not seeUSEstatements inside contained subprograms.Process_Library.F90hadUSE module_mp_radarinside two contained subroutines (init_refl10cmandcalc_refl10cm), making the dependency onmodule_mp_radar.F90invisible to CMake. This was a latent bug that never fired before because compilation order happened to putmodule_mp_radar.F90first by coincidence.Commit
37878b71changedaer_actv_single_moment.F90toUSE GEOSmoist_Process_Library, which introduced a new intra-library dependency that reshuffled the compilation schedule and exposed the hidden gap.Moving
USE module_mp_radarto the module-levelUSEblock ofGEOSmoist_Process_Librarymakes the dependency visible to CMake. The symbols are then available toinit_refl10cmandcalc_refl10cmvia host association, which is semantically identical.Fix 2 —
GEOS_MoistGridComp.F90: replacenot()with.not.GCC:
Error: 'i' argument of 'not' intrinsic at (1) must be INTEGERRoot cause:
not()is the bitwise integer intrinsic;.not.is the logical negation operator. ifort silently acceptsnot()on logicals as a non-standard extension, but GCC correctly rejects it.Fix 3 —
GEOS_PhysicsGridComp.F90: pad strings in CHARACTER array constructorGCC:
Error: Different CHARACTER lengths (3/2) in array constructorRoot cause: The Fortran standard requires all elements of an array constructor to have the same character length.
'KM'and'RI'(length 2) were mixed with'ALH'(length 3). ifort accepted this silently; GCC correctly rejects it.