Skip to content

Commit 19276f1

Browse files
committed
Issue #23654: Fix faulthandler._stack_overflow() for the Intel C Compiler (ICC)
Issue #23654: Turn off ICC's tail call optimization for the stack_overflow generator. ICC turns the recursive tail call into a loop. Patch written by Matt Frank.
1 parent d4c2ac8 commit 19276f1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ Doug Fort
436436
Chris Foster
437437
John Fouhy
438438
Andrew Francis
439+
Matt Frank
439440
Stefan Franke
440441
Martin Franklin
441442
Kent Frazier

Modules/faulthandler.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args)
911911
}
912912

913913
#if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION)
914-
static Py_uintptr_t
914+
#ifdef __INTEL_COMPILER
915+
/* Issue #23654: Turn off ICC's tail call optimization for the
916+
* stack_overflow generator. ICC turns the recursive tail call into
917+
* a loop. */
918+
# pragma intel optimization_level 0
919+
#endif
920+
static
921+
Py_uintptr_t
915922
stack_overflow(Py_uintptr_t min_sp, Py_uintptr_t max_sp, size_t *depth)
916923
{
917924
/* allocate 4096 bytes on the stack at each call */

0 commit comments

Comments
 (0)