python36/fix-faulthandler._stack_ove...

28 lines
945 B
Diff
Raw Normal View History

2021-02-24 15:05:05 +09:00
--- Modules/faulthandler.c
+++ Modules/faulthandler.c
@@ -1161,18 +1161,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args)
#if defined(FAULTHANDLER_USE_ALT_STACK)
#define FAULTHANDLER_STACK_OVERFLOW
-#ifdef __INTEL_COMPILER
- /* Issue #23654: Turn off ICC's tail call optimization for the
- * stack_overflow generator. ICC turns the recursive tail call into
- * a loop. */
-# pragma intel optimization_level 0
-#endif
-static
-uintptr_t
+static uintptr_t
stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth)
{
- /* allocate 4096 bytes on the stack at each call */
- unsigned char buffer[4096];
+ /* Allocate (at least) 4096 bytes on the stack at each call.
+
+ bpo-23654, bpo-38965: use volatile keyword to prevent tail call
+ optimization. */
+ volatile unsigned char buffer[4096];
uintptr_t sp = (uintptr_t)&buffer;
*depth += 1;
if (sp < min_sp || max_sp < sp)