https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107071
--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- Right now the code to test support is indeed like this for glibc targets except x86/x86_64 (libgfortran/config/fpu-glibc.h): int support_fpu_rounding_mode (int mode) { switch (mode) { case GFC_FPE_TONEAREST: #ifdef FE_TONEAREST return 1; #else return 0; #endif … so the correct code would be instead: int support_fpu_rounding_mode (int mode) { int oldmode, res; switch (mode) { case GFC_FPE_TONEAREST: #ifdef FE_TONEAREST oldmode = fegetround (); res = fesetround (FE_TONEAREST); fesetround (oldmode); return res ? 0 : 1; #else return 0; #endif … Does that seem correct to you? Also, looking at the doc, I think this file may need to have this line somewhere at the top: #pragma STDC FENV_ACCESS ON