From: Taylor R Campbell Date: Fri, 19 Nov 2010 07:24:54 +0000 (+0000) Subject: Work around bug in glibc's fegetenv on amd64. X-Git-Tag: 20101212-Gtk~13 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=4f7c69ec69df9db95537bd62ed0a538aeef6696f;p=mit-scheme.git Work around bug in glibc's fegetenv on amd64. --- 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