This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: # Re: [RFD] -ffinite-math-only.


Toon Moene wrote:
> 
> Brad Lucier wrote:
> 
> >>Toon Moene wrote:
> 
> >>No, your mixing "undefined behaviour" with "yields a processor-dependent 
> >>approximation to".  Undefined behaviour in Fortran speak means: The 
> >>`processor' (compiler+assembler+linker+OS+hardware) can do what it likes 
> >>with your program, because it just broke the rules.
> > 
> > 
> > Actually, I don't think I'm mixing those two things.  I just looked through
> > the f77 standard and I can't find where dividing by zero, for example,
> > leads to "undefined behavior".  It may be there, but I can't find it.
> 
> http://www.fortran.com/f77_std/rjcnf-6.html#sh-6.6:

Should be

http://www.fortran.com/F77_std/rjcnf-6.html#sh-6.6

Thanks for the electronic link, it's a lot easier to search than the
hard copy ;-).

> Any arithmetic operation whose result is not mathematically defined is 
> prohibited in the execution of an executable program.  Examples are 
> dividing by zero and raising a zero-valued primary to a zero-valued or 
> negative valued exponent.  Raising a negative-valued primary to a real 
> or double precision power is also prohibited.
> 
> You're right.  It doesn't say "undefined behaviour", it says: 
> "prohibited".  I think that's just as good :-)
> 
> >>Well, I'd say that if people use Fortran 77, they should either (1) know 
> >>the model of arithmetic it supplies and adhere to that 
> 
> > I don't think that f77 *has* a model of arithmetic precise enough to
> > "adhere to". 
> 
> It *is* quite precise in what is prohibited.  The operations that 
> produce NaNs or Infinities are prohibited.  That means that someone who 
> relies on a Fortran 77 program to do this correctly is relying on an 
> extension of Fortran 77.

The standard doesn't define "mathematically defined", it only gives examples.
I think I've found the only relevant sections: 6.6, 15.3.3, and 15.10.1.

But I'm getting as tired of this discussion as you probably are.  I think
that default optimizing away operations that the underlying hardware supports 
is the wrong way to go.  You don't.  I think that moving g77 to support
IEEE arithmetic in ways that, e.g., Sun Fortran or Intel Fortran do is the
way to go.  You don't.  I'm not the Fortran maintainer, you are.

End of the line with this discussion.

Brad


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]