This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/81344] Can't disable -ffpe-trap (or not documented)
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Jul 2017 11:59:39 +0000
- Subject: [Bug fortran/81344] Can't disable -ffpe-trap (or not documented)
- Auto-submitted: auto-generated
- References: <bug-81344-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81344
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-07-07
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Once I enable a floating point exception trap with "-ffpe-trap=whatever",
> it doesn't seem to be possible to disable it in the same command line
> (as it is possible with warnings, for instance. An empty list as in
> "-ffpe-trap=" is accepted, but it doesn't disable traps.
AFAIU gfc_handle_fpe_option in gcc/fortran/options.c, '-ffpe-trap=set1
-ffpe-trap=set2' is equivalent to '-ffpe-trap=set1,set2'.
If it helps, I can add a line in the manual.
Note that this is not true for '-ffpe-summary=set1 -ffpe-summary=set2' which
reports the exceptions for set2 only.
> This would be useful when using a tool like CMake, where it is convenient
> to set a default set of flags, and then override them if desired in specific
> files, rather.
(1) You cal always use '-ffpe-trap=set1,set2' for some files and
'-ffpe-trap=set1' for some other files.
(2) You can look at the code implementing -fcheck=no-diag and implement a
-ffpe-trap=no-execpt. IMO it does not worth the trouble.
The above have been tested with
! test the -ffpe-trap= and -ffpe-summary= options.
program main
real a,b,c
a=1e-20
b=a**2
print *,b
a=0
b=0
c=a/b
print *,c
c=1./b
print *,c
STOP
end