summaryrefslogtreecommitdiff
path: root/Cython/Utility/ModuleSetupCode.c
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2018-05-18 18:31:13 +0200
committerStefan Behnel <stefan_ml@behnel.de>2018-05-18 18:33:54 +0200
commit8e618b58edbfc145c81b23f8bb7208cce0d3221c (patch)
tree9f205d087a0bd859c951a6ec6753ea9d4c0c76d7 /Cython/Utility/ModuleSetupCode.c
parent27ad490bddddedfcc332c8f98656cccdc5e60dc2 (diff)
downloadcython-8e618b58edbfc145c81b23f8bb7208cce0d3221c.tar.gz
Avoid segfault due to a bug in g++ 4.4.7 when the -Os setting for the module init function is enabled.
Closes #2235.
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r--Cython/Utility/ModuleSetupCode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index a96f6f5e9..c1ba400fb 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -669,7 +669,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
#define CYTHON_SMALL_CODE
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
+ // At least g++ 4.4.7 can generate crashing code with this option. (GH #2235)
#define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
#else
#define CYTHON_SMALL_CODE