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]

-ffinite-math-only and g77.


L.S.,

After consultation of comp.lang.fortran, reading through the Fortran 95 Standard and the upcomping Fortran 2000 Standard, and off-list discussion, I've come to the conclusion that it serves g77 future best if I remove the default setting of -ffinite-math-only from f/com.c

Basically, the Standards after Fortran 77 lifted the "prohibited" ban on "arithmetic not mathematically defined" and introduced the possibility that NaNs and Infs could legally be produced by conformant Fortran programs.

To err on the safe side, g77 now preserves the non-finite arithmetic as it has in previous releases.

Change bootstrapped and make -k check-g77'd on powerpc-unknown-linux-gnu.

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
2002-08-31  Toon Moene  <toon@moene.indiv.nluug.nl>

	* com.c: Don't set flag_finite_math_only by default.
	* invoke.texi: Reverse the documentation of option
	-ffinite-math-only to reflect the new default.

*** com.c.orig	Wed Jul 31 00:23:26 2002
--- com.c	Sat Aug 31 12:51:17 2002
*************** ffe_init_options ()
*** 14177,14181 ****
    flag_argument_noalias = 2;
    flag_merge_constants = 2;
-   flag_finite_math_only = 1;
    flag_errno_math = 0;
    flag_complex_divide_method = 1;
--- 14177,14180 ----
*** invoke.texi.orig	Sun Aug  4 23:41:41 2002
--- invoke.texi	Sat Aug 31 12:54:35 2002
*************** by type.  Explanations are in the follow
*** 183,187 ****
  -ffloat-store  -fforce-mem  -fforce-addr  -fno-inline @gol
  -ffast-math  -fstrength-reduce  -frerun-cse-after-loop @gol
! -funsafe-math-optimizations -fno-finite-math-only -fno-trapping-math @gol
  -fexpensive-optimizations  -fdelayed-branch @gol
  -fschedule-insns  -fschedule-insn2  -fcaller-saves @gol
--- 183,187 ----
  -ffloat-store  -fforce-mem  -fforce-addr  -fno-inline @gol
  -ffast-math  -fstrength-reduce  -frerun-cse-after-loop @gol
! -funsafe-math-optimizations -ffinite-math-only -fno-trapping-math @gol
  -fexpensive-optimizations  -fdelayed-branch @gol
  -fschedule-insns  -fschedule-insn2  -fcaller-saves @gol
*************** Note that if you are not optimizing, no 
*** 1543,1548 ****
  Might allow some programs designed to not be too dependent
  on IEEE behavior for floating-point to run faster, or die trying.
! Sets @option{-funsafe-math-optimizations}, and
! @option{-fno-trapping-math}.
  
  @cindex -funsafe-math-optimizations option
--- 1543,1548 ----
  Might allow some programs designed to not be too dependent
  on IEEE behavior for floating-point to run faster, or die trying.
! Sets @option{-funsafe-math-optimizations}, @option{-ffinite-math-only},
! and @option{-fno-trapping-math}.
  
  @cindex -funsafe-math-optimizations option
*************** Allow optimizations that may be give inc
*** 1552,1563 ****
  for certain IEEE inputs.
  
! @cindex -fno-finite-math-only option
! @cindex options, -fno-finite-math-only
! @item -fno-finite-math-only
! Fortran specifies all arithmetic that can result in a NaN or an
! infinity as ``giving undefined results'', therefore the compiler
! by default operates in a way that assumes no NaNs or +-Inf can
! be generated.  If your program might generate or use NaNs or
! infinities, then you should use this option.
  
  @cindex -fno-trapping-math option
--- 1552,1566 ----
  for certain IEEE inputs.
  
! @cindex -ffinite-math-only option
! @cindex options, -ffinite-math-only
! @item -ffinite-math-only
! Allow optimizations for floating-point arithmetic that assume
! that arguments and results are not NaNs or +-Infs.
! 
! This option should never be turned on by any @option{-O} option since
! it can result in incorrect output for programs which depend on
! an exact implementation of IEEE or ISO rules/specifications.
! 
! The default is @option{-fno-finite-math-only}.
  
  @cindex -fno-trapping-math option

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