From 4f7c69ec69df9db95537bd62ed0a538aeef6696f Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 19 Nov 2010 07:24:54 +0000 Subject: [PATCH] Work around bug in glibc's fegetenv on amd64. --- src/microcode/floenv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/microcode/floenv.c b/src/microcode/floenv.c index 1c5454818..bdc9d6541 100644 --- a/src/microcode/floenv.c +++ b/src/microcode/floenv.c @@ -65,6 +65,12 @@ cache_float_environment (void) if (0 != (fegetenv (&scheme_fenv))) error_external_return (); scheme_fenv_p = true; + /* Work around glibc lossage: fesetenv has the side effect of masking + all exception traps on amd64. */ +# ifdef HAVE_FESETENV + if (0 != (fesetenv (&scheme_fenv))) + error_external_return (); +# endif #endif } @@ -130,6 +136,11 @@ DEFINE_PRIMITIVE ("FLOAT-ENVIRONMENT", Prim_float_environment, 0, 0, 0) SCHEME_OBJECT environment = (allocate_fenv (&envp)); if (0 != (fegetenv (envp))) error_external_return (); + /* Work around glibc lossage. */ +# ifdef HAVE_FESETENV + if (0 != (fesetenv (envp))) + error_external_return (); +# endif PRIMITIVE_RETURN (environment); } #else -- 2.25.1