Branch
Hash :
f3b9112a
Author :
Date :
2025-06-11T14:43:04
fenv*: Fix compilation error with mingw 13. It's caused by an ABI change in mingw: <https://sourceforge.net/p/mingw-w64/mingw-w64/ci/5c5973cf5f021db8fd75e9667e63881ccd169320/>. Reported by Collin Funk in <https://lists.gnu.org/archive/html/bug-gnulib/2025-04/msg00215.html>. * m4/fenv-environment.m4 (gl_FENV_ENVIRONMENT): Update comments for mingw 13. * lib/fenv-private.h (exceptions_to_x86hardware, x86hardware_to_exceptions): On mingw >= 13, define these like on MSVC. * lib/fenv-round.c (fegetround, fesetround): Do the safe mapping also on mingw >= 13. * lib/fenv-except-state-set.c (fesetexceptflag): Do the exceptions_to_x86hardware conversion also on other platforms than MSVC. * lib/fenv-except-tracking-clear.c (feclearexcept): Likewise. * lib/fenv-except-tracking-set.c (fesetexcept): Likewise. * lib/fenv-except-trapping.c (feenableexcept, fedisableexcept, fegetexcept): Do the exceptions_to_x86hardware and x86hardware_to_exceptions conversions also on other platforms than MSVC. * lib/fenv-env.c (fegetenv, fesetenv): Add new implementation for mingw >= 13. * doc/posix-functions/fesetenv.texi: Mention the new mingw bug. * doc/posix-functions/feupdateenv.texi: Mention the new mingw bug.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
@node fesetenv
@subsection @code{fesetenv}
@findex fesetenv
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/fesetenv.html}
Gnulib module: fenv-environment
@mindex fenv-environment
Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
@item
This function does not work on some platforms:
@c https://cgit.freebsd.org/src/commit/?id=34cc08e336987a8ebc316595e3f552a4c09f1fd4
FreeBSD 12.2/arm64,
@c fesetenv (FE_DFL_ENV) does not reset the rounding direction.
mingw 13.
@item
This function does not restore the floating-point exception trap bits
on some platforms:
musl libc/i386, musl libc/x86_64, AIX 7.3, Solaris 10 and 11, MSVC 14.
@item
The macro @code{FE_DFL_ENV} cannot be used because it leads to a link error
on some platforms:
@c src/sys/arch/hppa/include/fenv.h src/lib/libm/arch/hppa/fenv.c
NetBSD 10.0/hppa,
@c src/sys/arch/{sparc,sparc64}/include/fenv.h src/lib/libm/arch/{sparc,sparc64}/fenv.c
NetBSD 10.0/sparc,
Cygwin 2.9.0.
@item
This function, when called with @code{FE_DFL_ENV} argument, has no effect
on the x86 @code{mxcsr} register and thus on floating-point operations
performed in the SSE unit on some platforms:
mingw 10.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize