I compile fortran with gfortran so that all (well, most) real variables are
initialized to NaN (not a number), and the resulting binary runs with
floating point exception to trap on invalid, zero and overflow.
  gfortran ... -finit-real=snan  -ffpe-trap=invalid,zero,overflow ..

The immediate effect is that when a value from what is normally an
uninitialized variable is used in a math operation, a SIGFPE is
raised (signal floating point exception).  Copies of NaNs don't trigger the
SIGFPE.

The ccf2 routine has an uninitialized local array variable ccf.  Under some
circumstances (I'm using live signals from the air), this call to peakup
  call peakup(ccf(lagpk-1),ccf(lagpk),ccf(lagpk+1),dx)
causes peakup to raise SIGFPE.  Debugging the ccf2 frame, it seems that
ccf(lagpk) is a number,but ccf(lagpk-1) is a NaN, as initialized per the
compiler.  lagpk is well within the declared range of array ccf.

I can make this error go away by assigning to ccf at the start of the
routine (viz `ccf=0.0`, but I don't know what the right initializer is),
but I think the root cause of the off by one error in the ccf2 routine
should be investigated and fixed.
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to