Mail Archives: djgpp/2001/11/22/12:20:46
On Thu, 22 Nov 2001, Graham Rangel-Sharp wrote:
> The problem is that im having to compile software written about 5 years ago
> on a sun machine. I can get it to compile and run on win2000 but after some
> time into the program, some of the calcutlations come out with answers of
> NaN. The software runs a simulation of a transister and incorporates many
> iterations, they seem to start of okay, giving sensible answers but about
> 20-30 mins into the running the strange results appear. I dont think its a
> problem with the code since it works fine on a friends linux machine.
GNU/Linux systems use a different math library, and also a different
setup of the FP processor. So assuming it's a DJGPP problem because the
GNU/Linux binary runs okay is not a recommended approach.
Let's begin with the basics: what compiler switches were used during
compilation and link of the program? Was libm.a, the math library,
linked in (do you see the -lm switch in the link command line)?
> I recently tried the win2k djdev204_alpha_win2k.zip which resulted in the
> NaN`s coming very much sooner during the program.
I suspect uninitialized memory (Unix and GNU/Linux systems initialize
memory allocated off the heap to all zeroes, while DJGPP doesn't do that,
for performance reasons). Try building the program with the
_CRT0_FLAG_FILL_SBRK_MEMORY bit set in the _crt0_startup_flags variable,
and see if the problems go away.
- Raw text -