From 78a282528d6eb9b044f0dac7c4421215a1ae3608 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 4 Dec 2019 09:28:47 +0100 Subject: [PATCH] bpo-38965: Fix stuck in test_stack_overflow tests. After update to GCC10, the testcase is stuck and a pragma needs to be added. --- .../Library/2019-12-04-08-46-23.bpo-38965.Yl4gI2asdfa.rst | 2 ++ Modules/faulthandler.c | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-12-04-08-46-23.bpo-38965.Yl4gI2asdfa.rst diff --git a/Misc/NEWS.d/next/Library/2019-12-04-08-46-23.bpo-38965.Yl4gI2asdfa.rst b/Misc/NEWS.d/next/Library/2019-12-04-08-46-23.bpo-38965.Yl4gI2asdfa.rst new file mode 100644 index 00000000000000..9c07fb6be0d7b5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-08-46-23.bpo-38965.Yl4gI2asdfa.rst @@ -0,0 +1,2 @@ +After update to GCC10, the testcase is stuck and +a pragma needs to be added. diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index d1280532ae2d4d..2543f11cb0a085 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1169,6 +1169,11 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args) #endif static uintptr_t +#ifdef __GNUC__ + /* For the very same reason, the GCC compiler can turn the tail + * call into a loop. */ +__attribute__((optimize("-O0"))) +#endif stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth) { /* allocate 4096 bytes on the stack at each call */