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

**URL:** <https://nemo-ocean.discourse.group/t/v4-0-x-northfold-crashes-at-initialization-with-debug-options/258>\
**Category:** v4.0.x\
**Tags:** LBC\
**Created:** [1 April 2022 15:11 UTC](https://nemo-ocean.discourse.group/t/v4-0-x-northfold-crashes-at-initialization-with-debug-options/258 "2022-04-01T15:11:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpelletier](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@cpelletier](https://nemo-ocean.discourse.group/u/cpelletier)\
**Post date:** [1 April 2022 15:11 UTC](https://nemo-ocean.discourse.group/t/v4-0-x-northfold-crashes-at-initialization-with-debug-options/258/1 "2022-04-01T15:11:38Z")

</div>

Hi,

Whenever I compile NEMO 4.0 (revision 15769) in debug mode, a floating point exception occurs in _lbcnfd.F90_ (see [here](https://mercatoroceanfr-my.sharepoint.com/:u:/g/personal/cpelletier_mercator-ocean_fr/ETNUWxX_jytDupQdIWRzKbMBwD5oec64tM-PWiTxqz0jyg?e=PMfNVi) 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:\*

```perl
%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](https://mercatoroceanfr-my.sharepoint.com/:f:/g/personal/cpelletier_mercator-ocean_fr/EuJKB3FCdoxOsCkFodcTgIwBiHG2oCIN10q2yPy5K4U2-g?e=CJWVGE), 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.

Thanks,  
Charles

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [1 April 2022 15:37 UTC](https://nemo-ocean.discourse.group/t/v4-0-x-northfold-crashes-at-initialization-with-debug-options/258/2 "2022-04-01T15:37:07Z")

</div>

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. 😅  
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).

---

<div class="post-metadata">

**Author:** ![cpelletier](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@cpelletier](https://nemo-ocean.discourse.group/u/cpelletier)\
**Post date:** [1 April 2022 16:14 UTC](https://nemo-ocean.discourse.group/t/v4-0-x-northfold-crashes-at-initialization-with-debug-options/258/3 "2022-04-01T16:14:11Z")

</div>

`ln_nnogather = .false.` does not work either, another error occurs, still in _lbcnfd.F90_, but in another place 😃

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