aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_dataflow.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-06-27 16:08:46 +0200
committerHans Bolinder <[email protected]>2014-08-21 09:22:08 +0200
commit6eac68854c414285b7a99f27196bbbfa7969b295 (patch)
tree11300443a664f962db49adbc1123dd9d69a50e49 /lib/dialyzer/src/dialyzer_dataflow.erl
parentdaed987f7ebae3fc8f969b4f55f225837267411b (diff)
downloadotp-6eac68854c414285b7a99f27196bbbfa7969b295.tar.gz
otp-6eac68854c414285b7a99f27196bbbfa7969b295.tar.bz2
otp-6eac68854c414285b7a99f27196bbbfa7969b295.zip
dialyzer, hipe: Fix a bug concerning is_record/2,3
Also fixed some cases where Dialyzer could crash due to reaching system limits.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_dataflow.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_dataflow.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl
index 92aab68ad6..03005e689f 100644
--- a/lib/dialyzer/src/dialyzer_dataflow.erl
+++ b/lib/dialyzer/src/dialyzer_dataflow.erl
@@ -93,6 +93,8 @@
-define(TYPE_LIMIT, 3).
+-define(BITS, 128).
+
-record(state, {callgraph :: dialyzer_callgraph:callgraph(),
envs :: env_tab(),
fun_tab :: fun_tab(),
@@ -1610,10 +1612,18 @@ bind_bin_segs([Seg|Segs], BinType, Acc, Map, State) ->
SizeVal = lists:max(List),
Flags = cerl:concrete(cerl:bitstr_flags(Seg)),
N = SizeVal * UnitVal,
- case lists:member(signed, Flags) of
- true -> t_from_range(-(1 bsl (N - 1)), 1 bsl (N - 1) - 1);
- false -> t_from_range(0, 1 bsl N - 1)
- end
+ case N >= ?BITS of
+ true ->
+ case lists:member(signed, Flags) of
+ true -> t_from_range(neg_inf, pos_inf);
+ false -> t_from_range(0, pos_inf)
+ end;
+ false ->
+ case lists:member(signed, Flags) of
+ true -> t_from_range(-(1 bsl (N - 1)), 1 bsl (N - 1) - 1);
+ false -> t_from_range(0, 1 bsl N - 1)
+ end
+ end
end
end,
{Map2, [_]} = bind_pat_vars([Val], [ValConstr], [], Map1, State, false),