aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/beam_utils_SUITE.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-06-25 13:19:32 +0200
committerErlang/OTP <[email protected]>2018-06-25 13:19:32 +0200
commit1718d838bd6bab0652cd8cb548bee48ff261cba5 (patch)
treeace1d8b67772f22ae220fc550c046b3a3d041e92 /lib/compiler/test/beam_utils_SUITE.erl
parent054855f37fe62674ef972452c5de94f9cceaccb7 (diff)
parent3dd17613fc7af70bc7f1222d7381533df0bd4eab (diff)
downloadotp-1718d838bd6bab0652cd8cb548bee48ff261cba5.tar.gz
otp-1718d838bd6bab0652cd8cb548bee48ff261cba5.tar.bz2
otp-1718d838bd6bab0652cd8cb548bee48ff261cba5.zip
Merge branch 'bjorn/compiler/fix-beam_utils/ERL-650/OTP-15150' into maint-21
* bjorn/compiler/fix-beam_utils/ERL-650/OTP-15150: Fix unsafe optimization when running beam_block the second time
Diffstat (limited to 'lib/compiler/test/beam_utils_SUITE.erl')
-rw-r--r--lib/compiler/test/beam_utils_SUITE.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_utils_SUITE.erl b/lib/compiler/test/beam_utils_SUITE.erl
index 3d35b546fc..360dcc1e84 100644
--- a/lib/compiler/test/beam_utils_SUITE.erl
+++ b/lib/compiler/test/beam_utils_SUITE.erl
@@ -132,6 +132,15 @@ bs_init(_Config) ->
<<"foo/foo">> = do_bs_init_4(<<"foo">>, true),
error = do_bs_init_4([], not_boolean),
+ Id = 17575,
+ Domain = -8798798,
+ [<<10,1:16,Id:16/signed>>,<<8,2:16,Domain:32/signed>>] =
+ do_bs_init_5(#{tag=>value,id=>Id,domain=>Domain}),
+ {'EXIT',{{required,id},[_|_]}} =
+ (catch do_bs_init_5(#{tag=>value,id=>nil,domain=>Domain})),
+ {'EXIT',{{required,domain},[_|_]}} =
+ (catch do_bs_init_5(#{tag=>value,id=>Id,domain=>nil})),
+
ok.
do_bs_init_1([?MODULE], Sz) ->
@@ -189,6 +198,20 @@ do_bs_init_4(Arg1, Arg2) ->
error
end.
+do_bs_init_5(#{tag := value, id := Id, domain := Domain}) ->
+ [case Id of
+ nil ->
+ error(id({required, id}));
+ _ ->
+ <<10, 1:16/signed, Id:16/signed>>
+ end,
+ case Domain of
+ nil ->
+ error(id({required, domain}));
+ _ ->
+ <<8, 2:16/signed, Domain:32/signed>>
+ end].
+
bs_save(_Config) ->
{a,30,<<>>} = do_bs_save(<<1:1,30:5>>),
{b,127,<<>>} = do_bs_save(<<1:1,31:5,0:1,127:7>>),