aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/icode
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2013-02-25 16:56:58 +0100
committerKostis Sagonas <[email protected]>2013-02-25 16:56:58 +0100
commit6907ed77452dcf409e0e3540cf7bd876e87b54b9 (patch)
tree34fae9978f3c51ffc6a264218ea6be8d0d3b9422 /lib/hipe/icode
parent6176e8accbb37f376070b92cdc70e9fe2b11f0f9 (diff)
downloadotp-6907ed77452dcf409e0e3540cf7bd876e87b54b9.tar.gz
otp-6907ed77452dcf409e0e3540cf7bd876e87b54b9.tar.bz2
otp-6907ed77452dcf409e0e3540cf7bd876e87b54b9.zip
Fix bug related to the handling of is_number/1 by the range analysis
The following module produced erroneous results when compiled with HiPE: -module(a). -export([foo/1]). foo(X) when is_number(X) -> is_integer(X). Running: 1> c(a). 2> a:foo(0). true 3> hipe:c(a). 4> a:foo(0). false % *** WRONG *** The problem was that the 'number' case for the `hipe_icode:type_test/1` was going to the default case where the argument was determined as being something other than an integer. Thanks to Sebastian Egner and Johannes Weißl for bringing the bug into attention. Fixed on the day it was reported.
Diffstat (limited to 'lib/hipe/icode')
-rw-r--r--lib/hipe/icode/hipe_icode_range.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl
index c222e8a5d5..46c5a39f2c 100644
--- a/lib/hipe/icode/hipe_icode_range.erl
+++ b/lib/hipe/icode/hipe_icode_range.erl
@@ -784,6 +784,8 @@ analyse_type(Type, Info, Rewrite) ->
integer ->
TrueRange = inf(any_range(), OldVarRange),
FalseRange = inf(none_range(), OldVarRange);
+ number ->
+ TrueRange = FalseRange = OldVarRange;
_ ->
TrueRange = inf(none_range(), OldVarRange),
FalseRange = OldVarRange