Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/lang/ecl/files/patch-75877dd.c
16151 views
1
From 75877dd8f0d534552284ba4380ba65baa74f028f Mon Sep 17 00:00:00 2001
2
From: Marius Gerbershagen
3
Date: Sun, 28 Jun 2020 11:02:15 +0200
4
Subject: [PATCH] fpe: fix ECL_WITH_LISP_FPE macro
5
6
We can't use ecl_process_env_unsafe() == NULL to check if ECL has
7
booted because the return value of ecl_process_env_unsafe is
8
unpredictable before ECL has booted. The reason is that
9
ecl_process_env_unsafe calls pthread_getspecific with an uninitialized
10
key stored in cl_env_key. But another call to pthread_setspecific
11
might have already registered a key which happens to be the same as
12
the not yet initialized cl_env_key, yielding a non-NULL value.
13
---
14
src/h/impl/math_fenv.h | 17 ++++++++---------
15
1 file changed, 8 insertions(+), 9 deletions(-)
16
17
diff --git a/src/h/impl/math_fenv.h b/src/h/impl/math_fenv.h
18
index 0a93c8e0a..9630f4c6c 100644
19
--- src/h/impl/math_fenv.h
20
+++ src/h/impl/math_fenv.h
21
@@ -72,15 +72,14 @@
22
23
#if defined(HAVE_FENV_H) && !defined(ECL_AVOID_FPE_H)
24
# if defined(HAVE_FEENABLEEXCEPT)
25
-# define ECL_WITH_LISP_FPE_BEGIN do { \
26
- fenv_t __fenv; \
27
- fegetenv(&__fenv); \
28
- cl_env_ptr __the_env = ecl_process_env_unsafe(); \
29
- if (__the_env) { \
30
- int bits = __the_env->trap_fpe_bits; \
31
- fedisableexcept(FE_ALL_EXCEPT & ~bits); \
32
- feenableexcept(FE_ALL_EXCEPT & bits); \
33
- } \
34
+# define ECL_WITH_LISP_FPE_BEGIN do { \
35
+ fenv_t __fenv; \
36
+ fegetenv(&__fenv); \
37
+ if (ecl_get_option(ECL_OPT_BOOTED) > 0) { \
38
+ int bits = ecl_process_env()->trap_fpe_bits; \
39
+ fedisableexcept(FE_ALL_EXCEPT & ~bits); \
40
+ feenableexcept(FE_ALL_EXCEPT & bits); \
41
+ } \
42
feclearexcept(FE_ALL_EXCEPT);
43
# else
44
# define ECL_WITH_LISP_FPE_BEGIN do { \
45
--
46
GitLab
47
48
49