incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <>
Subject [jira] Created: (STDCXX-61) [MSVC] bad casts in __rw_atomic_xxx() functions
Date Tue, 01 Nov 2005 22:14:55 GMT
[MSVC] bad casts in __rw_atomic_xxx() functions

         Key: STDCXX-61
     Project: STDCXX
        Type: Bug
  Components: Build  
    Versions: 4.1.2    
 Environment: MSVC
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
     Fix For: 4.1.3

-------- Original Message --------
Subject: Problems in __rw_atomic_ operations for Win32 (_mutex.h)
Date: Tue, 1 Nov 2005 19:49:49 +0300
From: Anton Pevtsov <>
To: <>

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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message