From 0f4b1294f51983f834dbca750b3ad271d72f740a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 17 Aug 2010 11:22:08 +0200 Subject: Solaris/x86: Handle floating point exceptions properly in driver threads On Solaris/x86, the floating point exceptions bits seems to be propagated to child threads, so if scheduler threads use floating points exceptions, also driver threads will have floating points exception enabled. The problem is that erts_thread_init_float() has not been called for driver threads, and because of that matherr() will crash when called. Fix matherr() so that it will work even if erts_thread_init_float() has not been called. This fix was suggested by Mikael Pettersson. --- erts/emulator/sys/unix/sys_float.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c index c59c99f65e..d6d06d0036 100644 --- a/erts/emulator/sys/unix/sys_float.c +++ b/erts/emulator/sys/unix/sys_float.c @@ -810,7 +810,9 @@ int matherr(struct exception *exc) { #if !defined(NO_FPE_SIGNALS) - set_current_fp_exception((unsigned long)__builtin_return_address(0)); + volatile unsigned long *fpexnp = erts_get_current_fp_exception(); + if (fpexnp != NULL) + *fpexnp = (unsigned long)__builtin_return_address(0); #endif return 1; } -- cgit v1.2.3