This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Floating Point Problem
- From: François-Xavier Coudert <fxcoudert at gmail dot com>
- To: Ron Young <ronyoung at adelphia dot net>
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 5 Oct 2005 09:39:36 +0200
- Subject: Re: Floating Point Problem
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sgqjr44T8D8/F6UKHAlkS+g9pMtFldw6QJ+Oof6dJbLD1nV5h6a6/F2gb5JZGG/fKZwKjhqsRZiZCZvSUwWm9m7c0eWkkmcE5AE0ohW1aO8pmT4eJkSIDtBYgTrkSiNWSrnbCbgBdB044ajRfjofjVUgkisqbXC1iw1xNiEi5kU=
- References: <KDEHIOGDKGKPNBLBLINJMEBMCJAA.ronyoung@adelphia.net>
- Reply-to: François-Xavier Coudert <fxcoudert at gmail dot com>
> Why would a program give me a output of all NaNs on my Pentium 4 and my
> Athlon64 , but not on my Pentium 3.
> I used flags -O3 -ffast-math -mfpmath=sse on all machines. The Intel
> compiler 7.1 runs this program fine.
>
> How can I trace this problem down?
What version of the compiler are you using?
You can:
1. isolate the optimisation switch that makes it happens; please
note that the documentation for -ffast-math says
This option should never be turned on by any `-O' option since it
can result in incorrect output for programs which depend on an
exact implementation of IEEE or ISO rules/specifications for math
functions.
2. we have a patch in queue that will enable gfortran to raise a
Floating Point Exception (FPE) on invalid operations, division by
zero, overflow, underflow and loss of precision. Soon (or now, if
you're able to build a compiler with the patch at
http://gcc.gnu.org/ml/fortran/2005-09/msg00514.html) you'll be able to
compile your code with "gfortran -ffte-trap=invalid" and see the first
nan as it happens, and know (with GDB) where it happened and what
values had the different variables.
FX