From 8e618b58edbfc145c81b23f8bb7208cce0d3221c Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 18 May 2018 18:31:13 +0200 Subject: Avoid segfault due to a bug in g++ 4.4.7 when the -Os setting for the module init function is enabled. Closes #2235. --- Cython/Utility/ModuleSetupCode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Cython/Utility/ModuleSetupCode.c') 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 -- cgit v1.2.1