[pypy-svn] r77942 - pypy/branch/32ptr-on-64bit/pypy/module/_rawffi

arigo at codespeak.net arigo at codespeak.net
Thu Oct 14 17:16:01 CEST 2010


Author: arigo
Date: Thu Oct 14 17:15:59 2010
New Revision: 77942

Modified:
   pypy/branch/32ptr-on-64bit/pypy/module/_rawffi/array.py
Log:
Merge r77941 from trunk.


Modified: pypy/branch/32ptr-on-64bit/pypy/module/_rawffi/array.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/module/_rawffi/array.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/module/_rawffi/array.py	Thu Oct 14 17:15:59 2010
@@ -97,7 +97,14 @@
 
 class W_ArrayInstance(W_DataInstance):
     def __init__(self, space, shape, length, address=r_uint(0)):
-        W_DataInstance.__init__(self, space, shape.size * length, address)
+        # XXX workaround for a bug in libffi on x86_64: make sure that
+        # we always have at least 8 bytes.  For W_ArrayInstances that are
+        # used as the result value of a function call, ffi_call() writes
+        # 8 bytes into it even if the function's result type asks for less.
+        memsize = shape.size * length
+        if memsize < 8:
+            memsize = 8
+        W_DataInstance.__init__(self, space, memsize, address)
         self.length = length
         self.shape = shape
 



More information about the Pypy-commit mailing list