https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110957

--- Comment #2 from anlauf at gcc dot gnu.org ---
Created attachment 56071
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56071&action=edit
Patch to fix mixed up parsing of fpe options

The attached patch fixes the mixup and adds the possibility to specify
-ffpe-trap=none to clear previously enabled exceptions on the command line.
Will submit this to the list.

Regarding the treatment of -f(no-)trapping-math, I played around a little
bit, and I am unsure what to do.

In gfortran, the option -ffpe-trap only sets the FPU mask in the main and
does nothing else.  Which I think is the major (sole?) purpose.

On the other hand, -f(no-)trapping-math has implications that affect
e.g. reassociation.  Adding to gfc_post_options() something like

  if (gfc_option.fpe != 0 && !flag_trapping_math)
    {
      gfc_warning_now (0, "Option %<-ffpe-trap=%> enforces "
                       "%<-ftrapping-math%> for Fortran");
      flag_trapping_math = 1;
    }

will generate different warnings for -O3 -ffast-math, -Ofast, and might
create more confusion than help users.

I tend to think that this part should not be implemented (now), unless
we better understand the implications of what a change of the defaults
in gcc means to gfortran.
  • [Bug fortran/110957] -ffpe-trap... anlauf at gcc dot gnu.org via Gcc-bugs

Reply via email to