Message273386
I came across this issue while researching where to post my patch (having come across this while building Python 2.7 & 3.x on AIX via xlc).
> In general in C, if a bit-field has type “int” without a signed or unsigned qualifier, it is up to the implementation which mode is chosen.
Unfortunately, the ISO C standard leaves it up to the compiler to decide whether to default to 'signed' or 'unsigned' for non-qualified bit-field declarations. gcc defaults to signed (https://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Non_002dbugs.html); however, xlc defaults to unsigned (https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/opt_bitfields.html).
> [...] having bitfields working regardless of the compiler should be preferred.
However, ctypes_test assumes an unqualified bit-field will be signed. To achieve bit-fields working regardless of the compiler, declarations must explicitly qualifying the sign for bit-fields. This makes the intent of what is expected explicit and avoids implementation-defined behavior that will differ from one compiler to the next.
With patch ctypes_test_sign_bitfields.diff provided, I have verified ctypes_test passes on Python 2.7, Python 3.4, and Python 3.5 (on AIX & Solaris). If need be, I'm happy to provide before-&-after output of ctypes_test with & without the patch applied (or verification from others would be greatly appreciated). |
|
Date |
User |
Action |
Args |
2016-08-22 17:43:51 | ericvw | set | recipients:
+ ericvw, martin.panter, Michael.Felt, aixtools@gmail.com |
2016-08-22 17:43:51 | ericvw | set | messageid: <1471887831.83.0.243090519669.issue27643@psf.upfronthosting.co.za> |
2016-08-22 17:43:51 | ericvw | link | issue27643 messages |
2016-08-22 17:43:51 | ericvw | create | |
|