The old Fortran 77 code in rmodf.f will not compile if using gcc version 12. User Tahir alerted me to this problem. It gives this error message:
1775 | call rmodfstr(key,irewind,'',card,1)
| 1
Warning: Type mismatch in argument ‘nrd’ at (1); passed CHARACTER(1) to INTEGER(4)
/opt/cpseis259/spws_home/util/cell/rmodf.f:1775:72: Error: Unexpected alternate return specifier in subroutine call at (1)
/opt/cpseis259/spws_home/util/cell/rmodf.f:2259:45:
The character * is being passed to subroutine rmodfstr(), which was expecting an integer. It seems that it needs 6 arguments, but the call at line 1775 only has 5. There should be an integer parameter in the third position. It appears that the third parameter is an output, so we can just put a dummy variable in third position.
Strangely old compilers did not have a fatal error with this bug. So probably rmodf.f is not important, but still needs fixing so CPSeis can be built.
Unfortunately, gfortran 12 finds "Missing alternate return specifiers" in rmodf.f after this. Line 4180, which can be removed as it it only for printout. Then line 4329, which seems to be triggered by rank mismatch. Then another at line 5091, and another at line 5818, for which I can not find any cure. rmodf.f is needed to make library libcell, which is needed by va.
Found another bug in subroutine rmod_read_grid()
It calls rmod_read_grid_1 with 3 extra arguments nx_mix,ny_mix,nz_mix
which are not in rmod_read_grid_1, so shifting the following arguments, and compiler did not find the alternate return specifier. Remove that line from subroutine call, and then it will compile.
However, there is still a lot of sloppy code in rmodf.f, so it needs compiler option -std=legacy,
and -Wall cannot be used either.