Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 1 addition & 0 deletions erts/emulator/beam/jit/arm/instr_arith.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ void BeamModuleAssembler::emit_i_bxor(const ArgLabel &Fail,

if (Fail.get() != 0) {
emit_enter_runtime(Live.get());
a.mov(ARG1, c_p);
runtime_call<3>(erts_bxor);
emit_leave_runtime(Live.get());
emit_branch_if_not_value(ARG1, resolve_beam_label(Fail, dispUnknown));
Expand Down
23 changes: 23 additions & 0 deletions erts/emulator/test/small_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,29 @@ test_bitwise(_Config) ->
merl:print(Tree),
{ok,_Bin} = merl:compile_and_load(Tree, []),
test_bitwise(Fs0, Mod),

%% Test invalid operands.
expect_badarith(fun(X) -> 42 band X end),
expect_badarith(fun(X) -> 42 bor X end),
expect_badarith(fun(X) -> 42 bxor X end),
expect_badarith(fun(X) -> X band 42 end),
expect_badarith(fun(X) -> X bor 42 end),
expect_badarith(fun(X) -> X bxor 42 end),
expect_fc(fun(X) when is_integer(42 band X) -> ok end),
expect_fc(fun(X) when is_integer(42 bor X) -> ok end),
expect_fc(fun(X) when is_integer(42 bxor X) -> ok end),
expect_fc(fun(X) when is_integer(X band 42) -> ok end),
expect_fc(fun(X) when is_integer(X bor 42) -> ok end),
expect_fc(fun(X) when is_integer(X bxor 42) -> ok end),

ok.

expect_fc(Fun) ->
{'EXIT',{function_clause,_}} = catch Fun(id(bad)),
ok.

expect_badarith(Fun) ->
{'EXIT',{badarith,_}} = catch Fun(id(bad)),
ok.

bitwise_gen_pairs() ->
Expand Down