Skip to content

Commit 480c606

Browse files
committed
Merge pull request #2099 from pguyot/w07/fix-jit-stacktrace-parameter
Fix a bug with `jit_raise` when calling `stacktrace_create_raw` These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 6f66fa4 + b7b0f0f commit 480c606

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/libAtomVM/jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static Context *jit_raise(Context *ctx, JITState *jit_state, int offset, term st
296296
TRACE("jit_raise: ctx->process_id = %" PRId32 ", offset = %d\n", ctx->process_id, offset);
297297
ctx->x[0] = stacktrace_exception_class(stacktrace);
298298
ctx->x[1] = exc_value;
299-
ctx->x[2] = stacktrace_create_raw(ctx, jit_state->module, offset, stacktrace);
299+
ctx->x[2] = stacktrace_create_raw(ctx, jit_state->module, offset, ctx->x[0]);
300300
return jit_handle_error(ctx, jit_state, 0);
301301
}
302302

tests/erlang_tests/test_exception_classes.erl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ start() ->
3232
ok = test_raise_error(),
3333
ok = test_raise_exit(),
3434
ok = test_raise_badarg(),
35+
ok = test_double_reraise(),
3536
0.
3637

3738
test_exit() ->
@@ -121,3 +122,19 @@ test_raise_badarg() ->
121122
catch
122123
C:V -> {unexpected, ?LINE, C, V}
123124
end.
125+
126+
test_double_reraise() ->
127+
try
128+
try
129+
try
130+
exit(foo)
131+
catch
132+
error:_ -> should_not_happen
133+
end
134+
catch
135+
error:_ -> should_not_happen
136+
end
137+
catch
138+
exit:foo -> ok;
139+
C:V -> {unexpected, ?LINE, C, V}
140+
end.

0 commit comments

Comments
 (0)