/debug:parallel causes boost::mutex to wait forever on ia32

/debug:parallel causes boost::mutex to wait forever on ia32

The boost libraries use the following inline assembly:

 inline bool interlocked_bit_test_and_set(long* x,long bit) { __asm { mov eax,bit; mov edx,x; lock bts [edx],eax; setc al; }; } inline bool interlocked_bit_test_and_reset(long* x,long bit) { __asm { mov eax,bit; mov edx,x; lock btr [edx],eax; setc al; }; } 

When /debug:parallel is set, the setc al; is immediately followed by mov "eax, esp", trashing the intended return value and causing an attempt to lock the mutex to wait forever (unless the lowest 8 bits of esp happen to be 0 of course).

I have reported this as a bug against boost (https://svn.boost.org/trac/boost/ticket/6931) along with a simple fix (move al into a temporary bool and return the temporary). However, this probably isn't the only instance of such a construct out there... so IMO, the extra code that /debug:parallel inserts should not trash any registers.

Orin.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Orin,
What's the reason for building with /debug:parallel? This option is for creating parallel debug checks used by the Intel IDB Debugger to detect data sharing event in OpenMP* parallelized code.
Regards, Hubert.

Hubert,

See my reply in the other thread. I am actually using OpenMP.

Orin.

Leave a Comment

Please sign in to add a comment. Not a member? Join today