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 meador.inge
Recipients hct, higstar, meador.inge, ned.deily, ocean-city, r.david.murray, stutzbach, theller, vladris
Date 2012-07-19.04:36:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342672596.67.0.134985248866.issue6493@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is with the 'BIT_MASK' macro, which is currently defined as the following for Windows:

   #define BIT_MASK(size) ((1 << NUM_BITS(size))-1)

The C standard says that any attempt to shift left by exactly the bit width is undefined behavior.  For the given test case 'NUM_BITS(size) == 32' and the '1' constant is of type 'int'.  Thus the behavior is undefined.

For x86 Windows with the MSVC++ compiler this ends up as 'SAL edx, CL' and the Intel manuals say that the shift count is masked by 0x1F.  Thus the bit mask ends up as '(1 << 0) - 1 == 0'.  Plug the zero mask into the 'SET' macro and you will see why the reported behavior is being observed.

I tested Hirokazu's last patch on Windows 7 64-bit and OS X 10.7;  I saw no regression.  I will apply the patch shortly.
History
Date User Action Args
2012-07-19 04:36:37meador.ingesetrecipients: + meador.inge, theller, ocean-city, ned.deily, stutzbach, r.david.murray, higstar, vladris, hct
2012-07-19 04:36:36meador.ingesetmessageid: <1342672596.67.0.134985248866.issue6493@psf.upfronthosting.co.za>
2012-07-19 04:36:35meador.ingelinkissue6493 messages
2012-07-19 04:36:34meador.ingecreate