Skip to content

Commit 1f5ce96

Browse files
committed
Durable fix for RISC-V interpreter crash.
1 parent dd253d0 commit 1f5ce96

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shared/runtime/pyexec.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input
9090

9191
nlr_buf_t nlr;
9292
nlr.ret_val = NULL;
93-
// CIRCUITPY-CHANGE
94-
mp_obj_t module_fun = mp_const_none;
9593
if (nlr_push(&nlr) == 0) {
94+
// CIRCUITPY-CHANGE: Made volatile to prevent gcc from re-ordering store of function pointer into stack frame
95+
// after call to gc_collect. For RISC-V this was causing free of the compiled function before execution.
96+
volatile mp_obj_t module_fun = mp_const_none;
9697
// CIRCUITPY-CHANGE
9798
#if CIRCUITPY_ATEXIT
9899
if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT))

0 commit comments

Comments
 (0)