aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/priv
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-02-08 07:06:31 +0100
committerBjörn Gustavsson <[email protected]>2016-02-08 08:08:55 +0100
commitabde1d03db03536af19fdb274f1119bbfaba262b (patch)
treefc7eb2311be3f3aa458fb298a5a23803b7bbfe67 /lib/compiler/priv
parenta03b7add86b92d0d7d2d744e5555314bedbc2197 (diff)
downloadotp-abde1d03db03536af19fdb274f1119bbfaba262b.tar.gz
otp-abde1d03db03536af19fdb274f1119bbfaba262b.tar.bz2
otp-abde1d03db03536af19fdb274f1119bbfaba262b.zip
Eliminate crash because of unsafe delaying of sub-binary creation
The following code would fail to compile: decode(<<Code/integer, Bin/binary>>) -> <<C1/integer, B1/binary>> = Bin, case C1 of X when X =:= 1 orelse X =:= 2 -> Bin2 = <<>>; _ -> Bin2 = B1 end, case Code of 1 -> decode(Bin2); _ -> Bin2 end. The error message would be: t: function decode/1+28: Internal consistency check failed - please report this bug. Instruction: return Error: {match_context,{x,0}}: The beam_bsm pass would delay the creation of a sub-binary when it was unsafe to do so. The culprit was the btb_follow_branch/3 function that for performance reasons cached labels that had already been checked. The problem was the safety of a label also depends on the contents of the registers. Therefore, the key for caching needs to be both the label and the register contents. Reported-by: José Valim
Diffstat (limited to 'lib/compiler/priv')
0 files changed, 0 insertions, 0 deletions