diff options
author | John Högberg <[email protected]> | 2018-09-25 14:03:52 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-09-25 14:25:58 +0200 |
commit | 6c968a18962ea85f9b426d98fbd3c7b3e527c038 (patch) | |
tree | 516fdb9cc836f70d8972777be1aad81a482435b3 /lib/compiler/test | |
parent | 672a164719fe5f0e2b3185034dfc3f761b5397e9 (diff) | |
download | otp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.tar.gz otp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.tar.bz2 otp-6c968a18962ea85f9b426d98fbd3c7b3e527c038.zip |
beam_validator: Use set_aliased_type in more operations
The following code broke because aliases weren't tracked for hd/1:
bug(Bool) ->
Bug = remote:call(),
if
Bool -> %% Branch of some kind.
_ = hd(Bug),
remote:call(),
hd(Bug)
end.
Related to 1f221b27f1336e747f7409692f260055dd3ddf79
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/beam_validator_SUITE.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index d3e544a9cc..661b48a080 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -34,7 +34,7 @@ undef_label/1,illegal_instruction/1,failing_gc_guard_bif/1, map_field_lists/1,cover_bin_opt/1, val_dsetel/1,bad_tuples/1,bad_try_catch_nesting/1, - receive_stacked/1]). + receive_stacked/1,aliased_types/1]). -include_lib("common_test/include/ct.hrl"). @@ -63,7 +63,7 @@ groups() -> undef_label,illegal_instruction,failing_gc_guard_bif, map_field_lists,cover_bin_opt,val_dsetel, bad_tuples,bad_try_catch_nesting, - receive_stacked]}]. + receive_stacked,aliased_types]}]. init_per_suite(Config) -> test_lib:recompile(?MODULE), @@ -579,6 +579,21 @@ receive_stacked(Config) -> ok. +%% ERL-735: validator failed to track types on aliased registers, rejecting +%% legitimate optimizations. +%% +%% move x0 y0 +%% bif hd L1 x0 +%% get_hd y0 %% The validator failed to see that y0 was a list +aliased_types(Config) when is_list(Config) -> + Bug = lists:seq(1, 5), + if + Config =/= [gurka, gaffel] -> %% Pointless branch. + _ = hd(Bug), + lists:seq(1, 5), + hd(Bug) + end. + %%%------------------------------------------------------------------------- transform_remove(Remove, Module) -> |