aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-04-13 12:17:35 +0000
committerErlang/OTP <[email protected]>2010-04-13 12:17:35 +0000
commitddceb09ba9f19da33c2fc45c5230c510221cc96e (patch)
tree92f9fc0d5606b4b3a79fa9a88c0613c1c2c7b8dd
parentc21626f453903b05655da48420f106bda31cb2da (diff)
parentfd9bb9fb7323ead417fff0cbb7a077b342446a77 (diff)
downloadotp-ddceb09ba9f19da33c2fc45c5230c510221cc96e.tar.gz
otp-ddceb09ba9f19da33c2fc45c5230c510221cc96e.tar.bz2
otp-ddceb09ba9f19da33c2fc45c5230c510221cc96e.zip
Merge branch 'bg/fconv' into dev
* bg/fconv: erts: Fix loading of modules with invalid floating point arithmetic
-rw-r--r--erts/emulator/beam/ops.tab2
-rw-r--r--erts/emulator/test/beam_SUITE.erl35
2 files changed, 30 insertions, 7 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 231ea34fd5..9e8ac74f40 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -1304,7 +1304,7 @@ fmul p FR1 FR2 FR3 => i_fmul FR1 FR2 FR3
fdiv p FR1 FR2 FR3 => i_fdiv FR1 FR2 FR3
fnegate p FR1 FR2 => i_fnegate FR1 FR2
-fconv Int=iq Dst=l => move Int x | fconv x Dst
+fconv Arg=iqan Dst=l => move Arg x | fconv x Dst
fmove q l
fmove d l
diff --git a/erts/emulator/test/beam_SUITE.erl b/erts/emulator/test/beam_SUITE.erl
index cc1626630b..228ff15341 100644
--- a/erts/emulator/test/beam_SUITE.erl
+++ b/erts/emulator/test/beam_SUITE.erl
@@ -1,26 +1,26 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(beam_SUITE).
-export([all/1, packed_registers/1, apply_last/1, apply_last_bif/1,
- buildo_mucho/1, heap_sizes/1, big_lists/1]).
+ buildo_mucho/1, heap_sizes/1, big_lists/1, fconv/1]).
-export([applied/2]).
@@ -279,3 +279,26 @@ b() ->
_} ->
ok
end.
+
+fconv(Config) when is_list(Config) ->
+ ?line do_fconv(atom),
+ ?line do_fconv(nil),
+ ?line do_fconv(tuple_literal),
+ ?line 3.0 = do_fconv(1.0, 2.0),
+ ok.
+
+do_fconv(Type) ->
+ try
+ do_fconv(Type, 1.0),
+ test_server:fail()
+ catch
+ error:badarith ->
+ ok
+ end.
+
+do_fconv(atom, Float) when is_float(Float) ->
+ Float + a;
+do_fconv(nil, Float) when is_float(Float) ->
+ Float + [];
+do_fconv(tuple_literal, Float) when is_float(Float) ->
+ Float + {a,b}.