diff --git a/src/gf.c b/src/gf.c index eeefe02300b00..3fc75f862500a 100644 --- a/src/gf.c +++ b/src/gf.c @@ -317,10 +317,19 @@ jl_code_info_t *jl_type_infer(jl_method_instance_t *mi, size_t world, int force) src = (jl_code_info_t*)jl_apply(fargs, 3); } JL_CATCH { - jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: encountered unexpected error in runtime:\n"); - jl_static_show((JL_STREAM*)STDERR_FILENO, jl_current_exception()); - jl_printf((JL_STREAM*)STDERR_FILENO, "\n"); - jlbacktrace(); // written to STDERR_FILENO + jl_value_t *e = jl_current_exception(); + if (e == jl_stackovf_exception) { + jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: stack overflow in type inference of "); + jl_static_show_func_sig((JL_STREAM*)STDERR_FILENO, (jl_value_t*)mi->specTypes); + jl_printf((JL_STREAM*)STDERR_FILENO, ".\n"); + jl_printf((JL_STREAM*)STDERR_FILENO, "This might be caused by recursion over very long tuples or argument lists.\n"); + } + else { + jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: encountered unexpected error in runtime:\n"); + jl_static_show((JL_STREAM*)STDERR_FILENO, e); + jl_printf((JL_STREAM*)STDERR_FILENO, "\n"); + jlbacktrace(); // written to STDERR_FILENO + } src = NULL; } ct->world_age = last_age;