Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libAtomVM/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static Context *jit_raise(Context *ctx, JITState *jit_state, int offset, term st
TRACE("jit_raise: ctx->process_id = %" PRId32 ", offset = %d\n", ctx->process_id, offset);
ctx->x[0] = stacktrace_exception_class(stacktrace);
ctx->x[1] = exc_value;
ctx->x[2] = stacktrace_create_raw(ctx, jit_state->module, offset, stacktrace);
ctx->x[2] = stacktrace_create_raw(ctx, jit_state->module, offset, ctx->x[0]);
return jit_handle_error(ctx, jit_state, 0);
}

Expand Down
17 changes: 17 additions & 0 deletions tests/erlang_tests/test_exception_classes.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ start() ->
ok = test_raise_error(),
ok = test_raise_exit(),
ok = test_raise_badarg(),
ok = test_double_reraise(),
0.

test_exit() ->
Expand Down Expand Up @@ -121,3 +122,19 @@ test_raise_badarg() ->
catch
C:V -> {unexpected, ?LINE, C, V}
end.

test_double_reraise() ->
try
try
try
exit(foo)
catch
error:_ -> should_not_happen
end
catch
error:_ -> should_not_happen
end
catch
exit:foo -> ok;
C:V -> {unexpected, ?LINE, C, V}
end.
Loading