For the sake of completeness, you could try to compile with gcc/gfortran 10. gfortran became stricter and the warnings may help you to find the root cause of the issue. Maybe you even try to compile it with a sanitizer.
For more info regarding gcc 10 see Build failures with GCC 10