aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-01-08 12:43:15 +0100
committerHans Bolinder <[email protected]>2018-01-08 12:45:55 +0100
commite8a8d0a81be4ef1ffbb5c382705a27bd24ebefea (patch)
treeb78b02ac3d292fe6c898e4d97febfa610aa29ed0 /lib/hipe
parent19b7ccfe076d88a96b62f3222f38be31bb087df2 (diff)
downloadotp-e8a8d0a81be4ef1ffbb5c382705a27bd24ebefea.tar.gz
otp-e8a8d0a81be4ef1ffbb5c382705a27bd24ebefea.tar.bz2
otp-e8a8d0a81be4ef1ffbb5c382705a27bd24ebefea.zip
dialyzer: Correct handling of erlang:abs/1
See also https://bugs.erlang.org/browse/ERL-551.
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index a3a936322a..2e56d25694 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -1992,9 +1992,11 @@ arith_abs(X1, Opaques) ->
case infinity_geq(Min1, 0) of
true -> {Min1, Max1};
false ->
+ NegMin1 = infinity_inv(Min1),
+ NegMax1 = infinity_inv(Max1),
case infinity_geq(Max1, 0) of
- true -> {0, infinity_inv(Min1)};
- false -> {infinity_inv(Max1), infinity_inv(Min1)}
+ true -> {0, max(NegMin1, Max1)};
+ false -> {NegMax1, NegMin1}
end
end,
t_from_range(NewMin, NewMax)