From owner-freebsd-questions Wed Jun 9 12:36: 1 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sand4.global.net.uk (sand4.global.net.uk [194.126.80.248]) by hub.freebsd.org (Postfix) with ESMTP id 7A03B15956 for ; Wed, 9 Jun 1999 12:35:20 -0700 (PDT) (envelope-from marko@globalnet.co.uk) Received: from p1cs09a06.client.global.net.uk ([195.147.217.29] helo=marder-1.) by sand4.global.net.uk with esmtp (Exim 2.12 #1) id 10ro7v-0007vF-00 for questions@freebsd.org; Wed, 9 Jun 1999 20:35:09 +0100 Received: (from marko@localhost) by marder-1. (8.9.2/8.8.8) id UAA00581 for questions@freebsd.org; Wed, 9 Jun 1999 20:32:58 +0100 (BST) (envelope-from marko) Date: Wed, 9 Jun 1999 20:32:58 +0100 From: Mark Ovens To: questions@freebsd.org Subject: gcc/egcs trouble passing a double Message-ID: <19990609203258.E261@marder-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I've got a wierd problem with a program I'm working on, trying to pass a double to a function. The program core dumps with a SIGFPE. I built a debug version and ran it in gdb to find the cause. A C++ function declared Datasym *install(const char *s, int t, double d, int stream) is called (from another C++ file) by s = install(sbuf, 261, 0.0, q_strm); In install() the SIGFPE (Arithmetic exception) occurrs at the line sp->val = d; Inserting a breakpoint at the start of install() and printing d shows it to be 8.275783586691418e-313 hence the SIGFPE, it's outside the range of a double, but why? 0.0 was passed in. All the other args are passed correctly. I've been trying to crack this for a couple of days now, but it's got me stumped. It's as though too much space is being allocated for a double. The only thing I can think of (& I'm guessing here) is that it's to do with the alignment of doubles and/or the stack and/or the start of functions on word boundaries. I see that there are several compiler options for controlling this, -malign-double, -mno-align-double, -malign-functions, -mpreferred-stack-boundary etc. Is this the cause? Can anyone suggest where I should start looking for the cause. Thanks. -- FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://www.users.globalnet.co.uk/~markov _______________________________________________________________ Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK CAD/CAM solutions for Sheetmetal Working Industry mailto:marko@uk.radan.com http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message