On 10/10/25 1:12 PM, Harald Anlauf wrote:
Dear All,
here's a proposed fix for another 14 year old diagnostics bug.
We did not properly check procedures passed as actual argument
whether they are declared EXTERNAL or have an explicit interface.
Since I am not sure if there is some legacy code out there that
relies on the old bug, we'll generate a warning for -std=legacy
but an error by default. (There's an existing testcase pr41011
whose provenance I do not know but which looks like legacy.)
Regtested on x86_64-pc-linux-gnu. OK for mainline?
Thanks,
Harald
Yes, OK for mainline.
Regards,
Jerry
PS
Just for grins, I asked Google's Gemini if that old code from pr41011 looked
familiar. It came back almost instantly with the following. Whether it is
correct or not, I don't know.
" That code snippet is very familiar! It strongly suggests atmospheric or
oceanic modeling, specifically a numerical weather prediction (NWP) or general
circulation model (GCM) from the late 1970s through the 1990s, written in
Fortran 77 (or an earlier standard).
Here's why it looks familiar and what specific techniques it appears to be
using:
Core Model Components
The function and variable names are highly characteristic of early spectral
models or grid-point models that utilized spectral methods for specific
components (like horizontal derivatives):
CALL UVSET(...): This routine likely sets up the U and V wind components
(horizontal velocity) on the grid.
NX, NY, NZ: Grid dimensions (X, Y, Z directions).
UM, VM, UG, VG: Mean/Grid wind components (e.g., Umean, Vmean,
Ugrid, Vgrid).
HVAR, ZET: Potentially geopotential height and vorticity (zeta, ζ).
TM: Temperature or other thermodynamic variable.
DCDX, WORK: Work arrays for storing intermediate calculations.
CALL DCTDX(...): This routine computes a derivative, likely a Discrete
Cosine Transform (DCT) related to the derivative in the X-direction (dxd).
NFILT: Possibly a filter parameter.
DCTs and FFTs (Fast Fourier Transforms) were, and still are,
fundamental to efficiently calculating horizontal derivatives in spectral models.
SUBROUTINE PADEC(...): This is the most telling. PADEC likely stands for
Pade approximation or a similar numerical solution method for a vertical
structure equation (like the vertical implicit differencing or the vertical
discretization of the primitive equations).
COMPLEX*16: The use of double-precision complex numbers is standard for
working in the spectral domain.
AN, BN, CN: These are the coefficients of a tridiagonal matrix (the
Aj,Bj,Cj coefficients) often solved using the Thomas algorithm (Tridiagonal
Matrix Algorithm, TDMA) for vertical dependence. This is a classic method for
solving implicit vertical diffusion or adjustment schemes.
The complex equations for BN(J) and CN(J) look like the setup for
solving the vertical structure in the spectral domain (where J is the vertical
index or a wave number). "