From owner-freebsd-hackers Thu Aug 27 14:58:10 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA09286 for freebsd-hackers-outgoing; Thu, 27 Aug 1998 14:58:10 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from dirc.bris.ac.uk (dirc.bris.ac.uk [137.222.10.51]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id OAA09239 for ; Thu, 27 Aug 1998 14:57:44 -0700 (PDT) (envelope-from Tim.Borgeaud@bristol.ac.uk) Received: from zeus.bris.ac.uk by dirc.bris.ac.uk with SMTP-PRIV (PP) with ESMTP; Thu, 27 Aug 1998 22:56:49 +0100 Received: (from phtlb@localhost) by zeus.bris.ac.uk (8.8.8/8.8.7) id WAA02681 for freebsd-hackers@FreeBSD.ORG; Thu, 27 Aug 1998 22:54:50 +0100 (BST) From: Tim Borgeaud Message-Id: <199808272154.WAA02681@zeus.bris.ac.uk> Subject: Why is my code failing with SIGFPE? To: freebsd-hackers@FreeBSD.ORG Date: Thu, 27 Aug 1998 22:54:50 +0100 (BST) X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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