aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-06-27 12:51:22 +0200
committerBjörn Gustavsson <[email protected]>2018-06-27 13:22:20 +0200
commit81ce942d77826dd7219f1226866ffb2fa71c1d28 (patch)
tree1763b4bb4dde689878c4be55de3ae6c0521629f8 /lib/compiler/src
parenta0ae44f324576104760a63fe6cf63e0ca31756fc (diff)
downloadotp-81ce942d77826dd7219f1226866ffb2fa71c1d28.tar.gz
otp-81ce942d77826dd7219f1226866ffb2fa71c1d28.tar.bz2
otp-81ce942d77826dd7219f1226866ffb2fa71c1d28.zip
beam_type: Fix unsafe optimization
beam_type assumed that the operand for the bs_context_to_binary instruction must be a binary. That is not correct; bs_context_to_binary accepts anything. Based on the incorrect assumption, beam_type would remove other test instructions. The bug was introduced in eee8655788d2, which was supposed to be just a refactoring commit. https://bugs.erlang.org/browse/ERL-655
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_type.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_type.erl b/lib/compiler/src/beam_type.erl
index b8c3ca1325..b5c979e529 100644
--- a/lib/compiler/src/beam_type.erl
+++ b/lib/compiler/src/beam_type.erl
@@ -559,7 +559,7 @@ update({bs_save2,_,_}, Ts) ->
update({bs_restore2,_,_}, Ts) ->
Ts;
update({bs_context_to_binary,Dst}, Ts) ->
- tdb_store(Dst, {binary,1}, Ts);
+ tdb_store(Dst, any, Ts);
update({test,bs_start_match2,_,_,[Src,_],Dst}, Ts0) ->
Ts = tdb_meet(Src, {binary,1}, Ts0),
tdb_copy(Src, Dst, Ts);