diff --git a/src/codegen.cpp b/src/codegen.cpp index 2e2afc02080a1..f1b0c570acc33 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7379,6 +7379,7 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con if (ctx.emission_context.TargetTriple.isAArch64() || ctx.emission_context.TargetTriple.isARM() || ctx.emission_context.TargetTriple.isPPC64()) { if (nest) { emit_error(ctx, "cfunction: closures are not supported on this platform"); + JL_GC_POP(); return jl_cgval_t(); } } diff --git a/src/rtutils.c b/src/rtutils.c index b7e7999320100..88109374cf061 100644 --- a/src/rtutils.c +++ b/src/rtutils.c @@ -297,6 +297,7 @@ JL_DLLEXPORT void jl_eh_restore_state(jl_task_t *ct, jl_handler_t *eh) JL_DLLEXPORT void jl_eh_restore_state_noexcept(jl_task_t *ct, jl_handler_t *eh) { + assert(ct->gcstack == eh->gcstack && "Incorrect GC usage under try catch"); ct->eh = eh->prev; ct->ptls->defer_signal = eh->defer_signal; // optional, but certain try-finally (in stream.jl) may be slightly harder to write without this }