diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2017-09-27 17:27:25 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2017-09-27 17:27:25 +0200 |
commit | 9aee8d3e5d4910cdf124318c379f79555c8a3f77 (patch) | |
tree | cb66ba2c4e855e4dba660322c08c1ed30ff34500 | |
parent | 41212096b2cbfed7a22c0976c0319f3c9142e4a7 (diff) | |
download | ocaml-MPR7638.tar.gz |
MPR#7638: in the Windows Mingw64 port, multithreaded programs compiled to bytecode can crash when raising an exception from C codeMPR7638
This is a known problem with setjmp/longjmp in Mingw64. This commit works around the issue by using GCC's __builtin_setjmp/__builtin_longjmp functions instead.
-rw-r--r-- | Changes | 5 | ||||
-rw-r--r-- | byterun/caml/fail.h | 7 |
2 files changed, 12 insertions, 0 deletions
@@ -564,6 +564,11 @@ Release branch for 4.06: under ocamldebug calls Pervasives.flush_all (Xavier Leroy, report by Paul Steckler, review by Gabriel Scherer) +- MPR#7638: in the Windows Mingw64 port, multithreaded programs compiled + to bytecode could crash when raising an exception from C code. + This looks like a Mingw64 issue, which we work around with GCC builtins. + (Xavier Leroy) + - GPR#1155: Fix a race condition with WAIT_NOHANG on Windows (Jérémie Dimino and David Allsopp) diff --git a/byterun/caml/fail.h b/byterun/caml/fail.h index 3ae82b1e96..54907e4259 100644 --- a/byterun/caml/fail.h +++ b/byterun/caml/fail.h @@ -44,6 +44,13 @@ struct longjmp_buffer { sigjmp_buf buf; }; +#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4 +/* MPR#7638: issues with setjmp/longjmp in Mingw64, use GCC builtins instead */ +struct longjmp_buffer { + intptr_t buf[5]; +}; +#define sigsetjmp(buf,save) __builtin_setjmp(buf) +#define siglongjmp(buf,val) __builtin_longjmp(buf,val) #else struct longjmp_buffer { jmp_buf buf; |