diff options
author | Björn Gustavsson <[email protected]> | 2017-03-15 12:46:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-03-15 12:46:51 +0100 |
commit | 97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2 (patch) | |
tree | 5068d7bc5428739cbd5787d4c69ec5801154a476 /lib/compiler | |
parent | 6cebbc8b9b5f2d18d0b142f26b4495235a60dd21 (diff) | |
parent | b837f46ba4c3662b93bb79b56b415dce75e3d71e (diff) | |
download | otp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.tar.gz otp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.tar.bz2 otp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.zip |
Merge pull request #1374 from bjorng/bjorn/compiler/fix-beam_type
beam_type: Avoid an internal consistency check failure
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_type.erl | 3 | ||||
-rw-r--r-- | lib/compiler/test/beam_type_SUITE.erl | 22 |
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_type.erl b/lib/compiler/src/beam_type.erl index 050c599d6b..2b5d558ee4 100644 --- a/lib/compiler/src/beam_type.erl +++ b/lib/compiler/src/beam_type.erl @@ -683,6 +683,9 @@ op_type('bsr') -> integer; op_type('div') -> integer; op_type(_) -> unknown. +flush(Rs, [{set,[_],[_,_,_],{bif,is_record,_}}|_]=Is0, Acc0) -> + Acc = flush_all(Rs, Is0, Acc0), + {[],Acc}; flush(Rs, [{set,[_],[],{put_tuple,_}}|_]=Is0, Acc0) -> Acc = flush_all(Rs, Is0, Acc0), {[],Acc}; diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl index 492067ef00..7ca544a537 100644 --- a/lib/compiler/test/beam_type_SUITE.erl +++ b/lib/compiler/test/beam_type_SUITE.erl @@ -22,7 +22,7 @@ -export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1, init_per_group/2,end_per_group/2, integers/1,coverage/1,booleans/1,setelement/1,cons/1, - tuple/1]). + tuple/1,record_float/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -37,7 +37,8 @@ groups() -> booleans, setelement, cons, - tuple + tuple, + record_float ]}]. init_per_suite(Config) -> @@ -126,5 +127,22 @@ tuple(_Config) -> do_tuple() -> {0, _} = {necessary}. +-record(x, {a}). + +record_float(_Config) -> + 17.0 = record_float(#x{a={0}}, 1700), + 23.0 = record_float(#x{a={0}}, 2300.0), + {'EXIT',{if_clause,_}} = (catch record_float(#x{a={1}}, 88)), + {'EXIT',{if_clause,_}} = (catch record_float(#x{a={}}, 88)), + {'EXIT',{if_clause,_}} = (catch record_float(#x{}, 88)), + ok. + +record_float(R, N0) -> + N = N0 / 100, + if element(1, R#x.a) =:= 0 -> + N + end. + + id(I) -> I. |