diff --git a/src/gc.c b/src/gc.c index 4221cb8e83f15..3d120cf47cccd 100644 --- a/src/gc.c +++ b/src/gc.c @@ -481,9 +481,11 @@ static void schedule_all_finalizers(arraylist_t *flist) JL_NOTSAFEPOINT void jl_gc_run_all_finalizers(jl_task_t *ct) { schedule_all_finalizers(&finalizer_list_marked); + // This could be run before we had a chance to setup all threads for (int i = 0;i < jl_n_threads;i++) { jl_ptls_t ptls2 = jl_all_tls_states[i]; - schedule_all_finalizers(&ptls2->finalizers); + if (ptls2) + schedule_all_finalizers(&ptls2->finalizers); } run_finalizers(ct); } diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl index 82e5dd5c04619..cc864db900a61 100644 --- a/test/cmdlineargs.jl +++ b/test/cmdlineargs.jl @@ -249,6 +249,9 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no` @test read(`$exename -p2 -t2 -e $code`, String) == "6" end + # Combining --threads and invalid -C should yield a decent error + @test !success(`$exename -t 2 -C invalidtarget`) + # --procs @test readchomp(`$exename -q -p 2 -e "println(nworkers())"`) == "2" @test !success(`$exename -p 0`)