aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/icode
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2011-02-02 12:29:59 +0200
committerNiclas Axelsson <[email protected]>2011-02-14 17:25:15 +0100
commit6c9a53e0e155dae4325fb104a4108cd6446940f3 (patch)
tree99de695e2d54dfafb115782a49c0f6ad8b430335 /lib/hipe/icode
parentb397a5b6d3dce5ad0be19a7bac262d6f636a666d (diff)
downloadotp-6c9a53e0e155dae4325fb104a4108cd6446940f3.tar.gz
otp-6c9a53e0e155dae4325fb104a4108cd6446940f3.tar.bz2
otp-6c9a53e0e155dae4325fb104a4108cd6446940f3.zip
Fix bug in the simplification of inexact comparisons
On 31/1/2011 Paul Guyot reported a bug in the native code compilation of inexact equality/inequality tests between floats and integers. The relevant test was: f(X) -> Y = X / 2, Y == 0. and hipe erroneously evaluated the calls f(0) and f(0.0) to 'false'. The culprit was in the simplification code of the Icode range analysis which used an erroneous test (lists:any/1 instead of lists:all/1).
Diffstat (limited to 'lib/hipe/icode')
-rw-r--r--lib/hipe/icode/hipe_icode_range.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl
index 91f6fb47f3..cdd5f7ace5 100644
--- a/lib/hipe/icode/hipe_icode_range.erl
+++ b/lib/hipe/icode/hipe_icode_range.erl
@@ -641,7 +641,7 @@ analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) ->
end,
%% io:format("TR1 = ~w\nTR2 = ~w\n", [TrueRange1, TrueRange2]),
True =
- case lists:any(fun range__is_none/1, [TrueRange1, TrueRange2]) of
+ case lists:all(fun range__is_none/1, [TrueRange1, TrueRange2]) of
true -> [];
false ->
TrueLabel = hipe_icode:if_true_label(If),
@@ -651,7 +651,7 @@ analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) ->
end,
%% io:format("FR1 = ~w\nFR2 = ~w\n", [FalseRange1, FalseRange2]),
False =
- case lists:any(fun range__is_none/1, [FalseRange1, FalseRange2]) of
+ case lists:all(fun range__is_none/1, [FalseRange1, FalseRange2]) of
true -> [];
false ->
FalseLabel = hipe_icode:if_false_label(If),