[v4.0.x] Northfold crashes at initialization with debug options


Whenever I compile NEMO 4.0 (revision 15769) in debug mode, a floating point exception occurs in lbcnfd.F90 (see here for a debug report). This issue can be reproduced with a reference ORCA2_ICE config (i.e. ORCA2_ICE_PISCES, but with TOP removed from CPP keys). Compilation flags are:*

%FCFLAGS -march=core-avx2 -i4 -r8 -g -O0 -debug all -traceback -fp-model strict -ftrapuv -check all,noarg_temp_created -fpe-all0 -ftz -init=arrays,snan,huge

Since this issue does not occur when compiling in production mode, I suspect that some array is not properly initialized, these debug options fill it with NaN's, and then that floating point exception pops up. This could potentially mean that an ill-initialized array is read in production mode, but I’m not sure.

If needed, the full setup has been uploaded there, but it really is ORCA2_ICE_PISCES without TOP/PISCES, sources being NEMO 4.0 revision 15769.

NEMO 4.2 runs fine in debug mode with the same compilation options, though.


I completely rewrote lbc_lnk and the NP folding in 4.2 to avoid this kind of problems… I am happy to see that you don’t have the problem with 4.2. :sweat_smile:
I am not sure we can fix this in 4.0, knowing that the bugfixes in the 4.0 branch must touch a minimum lines of code…
You can try to set ln_nnogather = .false. in the namelist to see if it fix the problem (but with a high coast on the performances).

ln_nnogather = .false. does not work either, another error occurs, still in lbcnfd.F90, but in another place :smiley:

Anyway, I understand that fixing these kinds of things in 4.0 is really not a priority. Thanks anyway!