[pypy-commit] pypy default: 32-bit: test and fix

arigo noreply at buildbot.pypy.org
Wed Sep 9 10:32:27 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r79558:dc417bfabae3
Date: 2015-09-09 10:32 +0200
http://bitbucket.org/pypy/pypy/changeset/dc417bfabae3/

Log:	32-bit: test and fix

diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -166,7 +166,7 @@
         return ConstInt(value)
     elif isinstance(value, bool):
         return ConstInt(int(value))
-    elif isinstance(value, float):
+    elif lltype.typeOf(value) == longlong.FLOATSTORAGE:
         return ConstFloat(value)
     else:
         assert lltype.typeOf(value) == llmemory.GCREF
diff --git a/rpython/jit/metainterp/test/test_float.py b/rpython/jit/metainterp/test/test_float.py
--- a/rpython/jit/metainterp/test/test_float.py
+++ b/rpython/jit/metainterp/test/test_float.py
@@ -66,6 +66,16 @@
         res = self.interp_operations(g, [-12345])
         assert type(res) is float and res == -12345.0
 
+    def test_cast_int_to_float_constant(self):
+        def h(i):
+            if i < 10:
+                i = 10
+            return i
+        def g(i):
+            return float(h(i))
+        res = self.interp_operations(g, [-12345])
+        assert type(res) is float and res == 10.0
+
     def test_cast_uint_to_float(self):
         def g(i):
             return float(r_uint(i))


More information about the pypy-commit mailing list