diff options
author | Björn Gustavsson <[email protected]> | 2009-12-11 22:25:51 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2009-12-11 22:43:39 +0100 |
commit | 88efa63b733b627934fb7eec6236c71d7acfe082 (patch) | |
tree | da691cf124f127927e85b7f30d8dd597a8e67235 /lib/compiler/test/bs_bit_binaries_SUITE.erl | |
parent | af198c489a7ab431fd1e2b52d16e8e13525915f7 (diff) | |
download | otp-88efa63b733b627934fb7eec6236c71d7acfe082.tar.gz otp-88efa63b733b627934fb7eec6236c71d7acfe082.tar.bz2 otp-88efa63b733b627934fb7eec6236c71d7acfe082.zip |
beam_bool: Fix generation of code that does not validate
The following code (by Simon Cornish)
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
CH1 = if Do1 == true;
Do1 == false,Do2==false,Do3 == blah ->
ch1;
true ->
no
end,
CH2 = if Do1 == true;
Do1 == false,Do2==false,Do3 == xx ->
ch2;
true ->
no
end,
{CH1,CH2}.
is optimized by beam_bool even though the optimization is not
safe. The trouble is that an assignment to {y,0} no longer
occurs on all paths leading to its use.
The bug is in dst_regs/2 which is supposed to return a set
of all registers assigned in a code block, but it ignores
registers assigned in 'move' instructions.
Fix the bug by taking 'move' instructions into account. This change
is safe since it can only cause more registers to be added
to the MustBeKilled and MustBeUnused sets in ensure_opt_safe/6,
which means that it can only cause the optimization to be turned
off for code that used to be optimized.
Diffstat (limited to 'lib/compiler/test/bs_bit_binaries_SUITE.erl')
0 files changed, 0 insertions, 0 deletions