From 6c9a53e0e155dae4325fb104a4108cd6446940f3 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 2 Feb 2011 12:29:59 +0200 Subject: 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). --- lib/hipe/icode/hipe_icode_range.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/hipe') 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), -- cgit v1.2.3