Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 1998 22:54:50 +0100 (BST)
From:      Tim Borgeaud <Tim.Borgeaud@bristol.ac.uk>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Why is my code failing with SIGFPE?
Message-ID:  <199808272154.WAA02681@zeus.bris.ac.uk>

next in thread | raw e-mail | index | archive | help

Sorry if this is bit off topic but I think someone reading the list can
probably help me.

I have some C-code which fails with floating point exceptions (SIGFPE errors).
Code compiles cleanly, although I am not using any additional options to gcc.

I am stumped as to the cause of these errors. Depending on where I put 
print statements in the code (for debugging purposes) it fails at different
points.

The code makes fairly heavy use of the CPU and is recursive. On the fourth call
of the recursive function the code fails with SIGFPE, sometimes in my code 
without any reason that I can find, but also commonly in __dtoa (called during
printf of a floating point number).

I have carefully gone through my code, sections of which seemed to be working
perfectly on their own. I cannot seem to find anything wrong. I can supply all or
parts of the code that I am trying to run if anyone is interested. I was hoping
that someone may have come across this kind of thing before.

The code has also been compiled using djgpp under msdos and has the same
problem. Two machines (Pentium and Pentium MMX) produce the same results.  

I have tried to use gdb, but because I have never used it before it didn't help
very much. All I found was that some of the floating point variable were
scrambled after the failure (eg some ridculous number x10^230 or something).


Many thanks

Tim


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808272154.WAA02681>