From 33fec496ee20829c2155452eb137d6a3252c7776 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Fri, 22 Dec 2023 16:07:01 +0000 Subject: [PATCH] Modify Caml_state->backtrace_last_exn properly --- ocaml/otherlibs/systhreads/st_stubs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocaml/otherlibs/systhreads/st_stubs.c b/ocaml/otherlibs/systhreads/st_stubs.c index 7b558ace99f..67cd5435b68 100644 --- a/ocaml/otherlibs/systhreads/st_stubs.c +++ b/ocaml/otherlibs/systhreads/st_stubs.c @@ -286,7 +286,8 @@ static void restore_runtime_state(caml_thread_t th) caml_set_local_arenas(Caml_state, th->local_arenas); Caml_state->backtrace_pos = th->backtrace_pos; Caml_state->backtrace_buffer = th->backtrace_buffer; - Caml_state->backtrace_last_exn = th->backtrace_last_exn; + caml_modify_generational_global_root + (&Caml_state->backtrace_last_exn, th->backtrace_last_exn); #ifndef NATIVE_CODE Caml_state->trap_sp_off = th->trap_sp_off; Caml_state->trap_barrier_off = th->trap_barrier_off;