This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: SIGFPE, Arithmetic exception. "Value optimized out" when using --ffast-math
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: "N.M. Maclaren" <nmm1 at cam dot ac dot uk>
- Cc: Toon Moene <toon at moene dot org>, Daniel Franke <franke dot daniel at gmail dot com>, fortran at gcc dot gnu dot org, Paul van Delst <Paul dot Vandelst at noaa dot gov>
- Date: Sat, 2 Jul 2011 11:11:31 -0700
- Subject: Re: SIGFPE, Arithmetic exception. "Value optimized out" when using --ffast-math
- References: <4E0B8B0C.4020105@noaa.gov> <20110629210237.GA12888@troutmask.apl.washington.edu> <4E0CCFBB.9010003@noaa.gov> <201106302213.37976.franke.daniel@gmail.com> <4E0F126A.2010609@moene.org> <20110702154450.GB45112@troutmask.apl.washington.edu> <Prayer.1.3.4.1107021901460.31198@hermes-2.csi.cam.ac.uk>
On Sat, Jul 02, 2011 at 07:01:46PM +0100, N.M. Maclaren wrote:
> On Jul 2 2011, Steve Kargl wrote:
> >On Sat, Jul 02, 2011 at 02:43:22PM +0200, Toon Moene wrote:
> >
> >>> -fno-math-errno,
> >>
> >> No valid Fortran program can look at the (C) variable errno, so
> >> it there is no value in pretending it can. Loses such sequences
> >> as (pseudo code):
> >> call sqrt(X)
> >> if (errno) then
> >> exit
> >> endif
> >
> >Apparently, you forgot about bind(c).
>
> Don't bet on it :-( If Toon meant 'x = sqrt(x)' with the Fortran intrinsic,
> then whether errno is set and to what is undefined. And, if he meant an
> external subroutine written in C, C99 abolished all sanity in the support
> for errno for arithmetic errors. It wasn't reliable even in C90.
>
Toon wrote "No valid Fortran program can look at the (C) variable errno".
I believe the code I posted was a valid Fortran program.
QED
--
Steve