Meador Inge <mead...@gmail.com> added the comment:

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.

----------
assignee:  -> meador.inge

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6493>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to