You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2005/12/09 02:33:09 UTC

[jira] Closed: (STDCXX-61) [MSVC] bad casts in __rw_atomic_xxx() functions

     [ http://issues.apache.org/jira/browse/STDCXX-61?page=all ]
     
Martin Sebor closed STDCXX-61:
------------------------------

    Resolution: Fixed

Fixed with the referenced change.

> [MSVC] bad casts in __rw_atomic_xxx() functions
> -----------------------------------------------
>
>          Key: STDCXX-61
>          URL: http://issues.apache.org/jira/browse/STDCXX-61
>      Project: STDCXX
>         Type: Bug
>   Components: Build
>     Versions: 4.1.2
>  Environment: MSVC
>     Reporter: Martin Sebor
>     Assignee: 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 <An...@moscow.vdiweb.com>
> Reply-To: stdcxx-dev@incubator.apache.org
> To: <st...@incubator.apache.org>
> 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));
> }
> This 
> _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
> __rw_atomic_exchange.
> Looks like instead of 
> _RWSTD_REINTERPRET_CAST (long*, __x)
> should be
> _RWSTD_REINTERPRET_CAST (long*, &__x)
> ?
> With best wishes,
> Anton Pevtsov.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira