Skip to content

Fix GFortran 10 "rank mismatch" warnings (#62)

jhennig requested to merge fix-gfortran10-warnings into devel

As of Matlab R2022a, GFortran 10 is the only supported Fortran compiler on Linux. However, when building the phase field library with GFortran 10 (or above), it would produce warnings such as:

Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-2)

The reason is that the Mex API function mxCopyPtrToReal8, according to its call signature, expects a real*8 array as its second argument, not a scalar, i.e. just a real*8 floating-point number. So we simply give it what it wants.

Actually, and for what it's worth, GFortran 10 wouldn't say a thing if it only saw calls with that harmless type mismatch. It would then silently convert the type and move on. But it spits out the above warning (which cannot be suppressed) when, anywhere else in the file, it finds calls where the parameter type happens to be "correct".

Merge request reports