Author: Armin Rigo <[email protected]>
Branch:
Changeset: r45146:521fbd1aef45
Date: 2011-06-27 19:42 +0200
http://bitbucket.org/pypy/pypy/changeset/521fbd1aef45/
Log: Add a failing test.
diff --git a/pypy/jit/backend/x86/test/test_runner.py
b/pypy/jit/backend/x86/test/test_runner.py
--- a/pypy/jit/backend/x86/test/test_runner.py
+++ b/pypy/jit/backend/x86/test/test_runner.py
@@ -6,6 +6,7 @@
ConstPtr, Box, BoxFloat,
BasicFailDescr)
from pypy.jit.backend.detect_cpu import getcpuclass
from pypy.jit.backend.x86.arch import WORD
+from pypy.jit.backend.x86.rx86 import fits_in_32bits
from pypy.jit.backend.llsupport import symbolic
from pypy.jit.metainterp.resoperation import rop
from pypy.jit.metainterp.executor import execute
@@ -241,6 +242,23 @@
c = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofsc3)
assert c.value == 3
+ def test_bug_setfield_64bit(self):
+ if WORD == 4:
+ py.test.skip("only for 64 bits")
+ TP = lltype.GcStruct('S', ('i', lltype.Signed))
+ ofsi = self.cpu.fielddescrof(TP, 'i')
+ for i in range(500):
+ p = lltype.malloc(S)
+ addr = rffi.cast(lltype.Signed, p)
+ if fits_in_32bits(addr):
+ break # fitting in 32 bits, good
+ else:
+ py.test.skip("cannot get a 32-bit pointer")
+ res = ConstPtr(rffi.cast(llmemory.GCREF, addr))
+ self.execute_operation(rop.SETFIELD_RAW, [res, ConstInt(3**33)],
+ 'void', ofsi)
+ assert p.i == 3**33
+
def test_nullity_with_guard(self):
allops = [rop.INT_IS_TRUE]
guards = [rop.GUARD_TRUE, rop.GUARD_FALSE]
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py
b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -37,7 +37,9 @@
if far_regions:
import random
pieces = far_regions._ll2ctypes_pieces
- num = random.randrange(len(pieces))
+ num = random.randrange(len(pieces)+1)
+ if num == len(pieces):
+ return ctype()
i1, stop = pieces[num]
i2 = i1 + ((ctypes.sizeof(ctype) or 1) + 7) & ~7
if i2 > stop:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit