[issue15119] ctypes mixed-types bitfield layout nonsensical; doesn't match compiler.
Mark Dickinson
report at bugs.python.org
Thu Jun 21 19:30:04 CEST 2012
Mark Dickinson <dickinsm at gmail.com> added the comment:
There are two separate issues here. The first is that the layout that ctypes chooses for a struct of bitfields fails basic sanity checks, like having each bitfield actually fit in the corresponding type. As a result, the C-level bitshifting code used to get bitfields ends up invoking undefined behaviour.
A secondary problem is that the ctypes layout doesn't match what the compiler does, at least for the system supplied gcc (4.2) on OS X 10.6.
The attached patch fixes the first issue, but not the second.
----------
keywords: +patch
title: Bug in ctypes bitfield layout? -> ctypes mixed-types bitfield layout nonsensical; doesn't match compiler.
Added file: http://bugs.python.org/file26072/ctypes_mixed_bitfields.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15119>
_______________________________________
More information about the Python-bugs-list
mailing list