https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110311
--- Comment #23 from anlauf at gcc dot gnu.org ---
You could check the input arguments for validity, e.g. using ieee_is_finite
from the intrinsic ieee_arithmetic module.
use, intrinsic :: ieee_arithmetic, only: ieee_is_finite
...
if (.not. ieee_is_finite (a)) then
print *, "bad: a=", a
stop 1
end if
As last resort I still recommend what I wrote in comment#15: build (=link)
your executable from *.o from your project build tree with known-good objects
but replacing one candidate.o by the one from the build tree showing the
problem.
And I really mean: link only und run.