This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aixtools@gmail.com
Recipients Michael.Felt, aixtools@gmail.com, ericvw, martin.panter
Date 2016-08-22.18:33:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <fe0747a4-ac1d-098d-85a9-14a610bf856f@gmail.com>
In-reply-to <1471887831.83.0.243090519669.issue27643@psf.upfronthosting.co.za>
Content
On 22-Aug-16 19:43, Eric N. Vander Weele wrote:
> Eric N. Vander Weele added the comment:
>
> 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).
>
> ----------
> Added file: http://bugs.python.org/file44189/ctypes_test_sign_bitfields.diff
I believe that there is a specific reason that M, N, O, P, Q, R and S 
are "short". For AIX/xlc at least "signed" is equivalent to "signed int" 
and not the same size as "unsigned short".

> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27643>
> _______________________________________
History
Date User Action Args
2016-08-22 18:33:27aixtools@gmail.comsetrecipients: + aixtools@gmail.com, ericvw, martin.panter, Michael.Felt
2016-08-22 18:33:27aixtools@gmail.comlinkissue27643 messages
2016-08-22 18:33:27aixtools@gmail.comcreate