aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-01-25 15:26:57 +0100
committerBjörn Gustavsson <[email protected]>2019-01-28 05:34:58 +0100
commit9528e7a5de22ffa8ce2557e45fb744d2c3548bf5 (patch)
treeb69b04bacc3d5d1f1d6c846d41a9aa808afbc722 /lib/compiler/test
parentd479269f2805aba973d1ff3dd7cc7387908cb3ed (diff)
downloadotp-9528e7a5de22ffa8ce2557e45fb744d2c3548bf5.tar.gz
otp-9528e7a5de22ffa8ce2557e45fb744d2c3548bf5.tar.bz2
otp-9528e7a5de22ffa8ce2557e45fb744d2c3548bf5.zip
Fix crash in beam_ssa_type
To improve compilation times, beam_ssa_type keeps track of variables that are only used once and don't keep types for those variables. As currently implemented, it turns to be unsafe. Change it to only keep track of variables that are only used in the terminator of the block they are defined in. https://bugs.erlang.org/browse/ERL-840
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/beam_type_SUITE.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl
index 6efa98de44..a7ffc3f60a 100644
--- a/lib/compiler/test/beam_type_SUITE.erl
+++ b/lib/compiler/test/beam_type_SUITE.erl
@@ -222,6 +222,9 @@ coverage(Config) ->
booleans(_Config) ->
{'EXIT',{{case_clause,_},_}} = (catch do_booleans_1(42)),
+ ok = do_booleans_2(42, 41),
+ error = do_booleans_2(42, 42),
+
AnyAtom = id(atom),
true = is_atom(AnyAtom),
false = is_boolean(AnyAtom),
@@ -250,6 +253,19 @@ do_booleans_1(B) ->
no -> no
end.
+do_booleans_2(A, B) ->
+ Not = not do_booleans_cmp(A, B),
+ case Not of
+ true ->
+ case Not of
+ true -> error;
+ false -> ok
+ end;
+ false -> ok
+ end.
+
+do_booleans_cmp(A, B) -> A > B.
+
setelement(_Config) ->
T0 = id({a,42}),
{a,_} = T0,