[pypy-dev] segfault in translation; C backend

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Thu Sep 8 05:15:22 CEST 2011


Hi,

[reply-ing to myself]

one of those things: I spent a several days banging my head on this and then
explaining it in an e-mail is enough to focus my thoughts and solve it.

That said, I'm not 100% sure what's going on. What I know is that I have
an opaque (or so I thought!) handle type, namely void*. However, after the
chain, the C back-end sees what I think is a (overly) recycled type:

   pypy.rpython.lltypesystem.ll2ctypes.c_ubyte_Array_33554431

so a char* of length 33554431 (or 0x1ffffff). This as the actual content of
what is marked a <C object Array of void  at 0x1>. So the code thinks it can
dereference void* handles as it really sees a char*. For the Reflex backend,
which uses valid pointers, that works up to some extend (apparently), but not
so in the case of the CINT as it uses indices, dereferencing of which gives
an immediate segfault.

So, I turn things into rffi.LONGs across the board and all is fine. Still, I
think that any attempt to dereference a void*, isn't very nice.

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list