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

--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
The comment in the front-end confirms the original intent, which is that FPU
shouldn't be messed with if the user didn't explicitly request it:

  /* If -ffpe-trap option was provided, add a call to set_fpe so that
     the library will raise a FPE when needed.  */

The patch below makes libgfortran behave in the same way:

Index: runtime/main.c
===================================================================
--- runtime/main.c      (revision 226632)
+++ runtime/main.c      (working copy)
@@ -263,7 +263,11 @@ init (void)
   init_variables ();

   init_units ();
-  set_fpu ();
+
+  /* If (and only if) the user asked for it, set up the FPU state.  */
+  if (options.fpe != 0)
+    set_fpu ();
+
   init_compile_options ();

 #ifdef DEBUG

Reply via email to