Ruby was running into a crash calling longjmp on a jmp_buf obtained by
calling setjmp from a function that had previously called alloca.  This
was resulting in mingw_getsp returning the *current* SP rather than the
"frame address"/"base pointer" for the frame.  This caused longjmp to
raise STATUS_BAD_STACK from RtlUnwindEx.

https://github.com/msys2/MINGW-packages/issues/9271

Signed-off-by: Jeremy Drake <[email protected]>
---
 mingw-w64-headers/crt/setjmp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h
index 4b69efa3b..3869c0870 100644
--- a/mingw-w64-headers/crt/setjmp.h
+++ b/mingw-w64-headers/crt/setjmp.h
@@ -233,7 +233,7 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp 
(void);
 #    elif defined(__SEH__)
 #     if defined(__aarch64__) || defined(_ARM64_)
 #      define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
-#     elif (__MINGW_GCC_VERSION < 40702)
+#     elif (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
 #      define setjmp(BUF) _setjmp((BUF), mingw_getsp())
 #     else
 #      define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
@@ -246,7 +246,7 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp 
(void);
 #  else
 #    undef setjmp
 #    ifdef __SEH__
-#     if (__MINGW_GCC_VERSION < 40702)
+#     if (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
 #      define setjmp(BUF) _setjmpex((BUF), mingw_getsp())
 #      define setjmpex(BUF) _setjmpex((BUF), mingw_getsp())
 #     else
-- 
2.32.0.windows.2


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to