aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-08-21 09:29:50 +0200
committerHans Bolinder <[email protected]>2014-08-21 09:29:50 +0200
commit05d8ce4d317df08076433296449083e9848b4d2d (patch)
tree8b9a919d8dd337b2da74ee3c8e4f19aa6a04e689 /lib/hipe
parent0f0befab60ccd0bb75972932299a2b4c0522325a (diff)
parent305bfc3360acfae8af75b36e00c61298b6ea582e (diff)
downloadotp-05d8ce4d317df08076433296449083e9848b4d2d.tar.gz
otp-05d8ce4d317df08076433296449083e9848b4d2d.tar.bz2
otp-05d8ce4d317df08076433296449083e9848b4d2d.zip
Merge branch 'maint'
* maint: dialyzer, hipe: Fix a bug concerning is_record/2,3
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl20
-rw-r--r--lib/hipe/cerl/erl_types.erl4
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index a460f16272..74e93bf098 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1891,7 +1891,11 @@ infinity_add(neg_inf, _Number) -> neg_inf;
infinity_add(_Number, pos_inf) -> pos_inf;
infinity_add(_Number, neg_inf) -> neg_inf;
infinity_add(Number1, Number2) when is_integer(Number1), is_integer(Number2) ->
- Number1 + Number2.
+ try Number1 + Number2
+ catch
+ error:system_limit when Number1 < 0 -> neg_inf;
+ error:system_limit -> pos_inf
+ end.
infinity_mult(neg_inf, Number) ->
Greater = infinity_geq(Number, 0),
@@ -1902,7 +1906,13 @@ infinity_mult(pos_inf, Number) -> infinity_inv(infinity_mult(neg_inf, Number));
infinity_mult(Number, pos_inf) -> infinity_inv(infinity_mult(neg_inf, Number));
infinity_mult(Number, neg_inf) -> infinity_mult(neg_inf, Number);
infinity_mult(Number1, Number2) when is_integer(Number1), is_integer(Number2)->
- Number1 * Number2.
+ try Number1 * Number2
+ catch
+ error:system_limit ->
+ if (Number1 >= 0) =:= (Number2 >= 0) -> pos_inf;
+ true -> neg_inf
+ end
+ end.
width({Min, Max}) -> infinity_max([width(Min), width(Max)]);
width(pos_inf) -> pos_inf;
@@ -2633,7 +2643,9 @@ opaque_args(M, F, A, Xs, Opaques) ->
true ->
case t_tuple_subtypes(X, Opaques) of
unknown -> false;
- List when length(List) >= 1 -> opaque_recargs(List, Y, Opaques)
+ List when length(List) >= 1 ->
+ (t_is_atom(Y, Opaques) andalso
+ opaque_recargs(List, Y, Opaques))
end;
false -> t_has_opaque_subtype(X, Opaques)
end];
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index b8ae31b622..5124e7238a 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -260,6 +260,8 @@
-define(TAG_IMMED1_SIZE, 4).
-define(BITS, (erlang:system_info(wordsize) * 8) - ?TAG_IMMED1_SIZE).
+-define(MAX_TUPLE_SIZE, (1 bsl 10)).
+
%%-----------------------------------------------------------------------------
%% Type tags and qualifiers
%%
@@ -1753,6 +1755,8 @@ t_tuple() ->
-spec t_tuple(non_neg_integer() | [erl_type()]) -> erl_type().
+t_tuple(N) when is_integer(N), N > ?MAX_TUPLE_SIZE ->
+ t_tuple();
t_tuple(N) when is_integer(N) ->
?tuple(lists:duplicate(N, ?any), N, ?any);
t_tuple(List) ->