stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <>
Subject Problems in __rw_atomic_ operations for Win32 (_mutex.h)
Date Tue, 01 Nov 2005 16:49:49 GMT
There is a problem in the __rw_atomic_preincrement function versions for
Win32 (see the include\rw\_mutex.h file, line 1352):

inline int
__rw_atomic_preincrement (int &__x, bool)
    _RWSTD_COMPILE_ASSERT (sizeof __x == sizeof (long));
    return InterlockedIncrement (_RWSTD_REINTERPRET_CAST (long*, __x));



tries to cast __x (not &__x !) to the long*.

After the casting the created temporary variable (to be passed to the
InterlockedIncrement function) contains the value of __x interpreted as
an valid address.
This results in that all stdcxx library examples crash. (They use
std::cout which uses these functions ?)

The same problem is in __rw_atomic_predecrement and

Looks like instead of 


should be



With best wishes,
Anton Pevtsov.

View raw message