Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10850: gcc-x86-implementation of "atomic_exchange_and_add" triggers intel's "unitialized variable" runtime check
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-04 18:23:51
#10850: gcc-x86-implementation of "atomic_exchange_and_add" triggers intel's
"unitialized variable" runtime check
--------------------------------------+-----------------------
Reporter: fabian.hachenberg@⦠| Owner: pdimov
Type: Patches | Status: new
Milestone: To Be Determined | Component: smart_ptr
Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-----------------------
Comment (by fabian.hachenberg@â¦):
Sorry for the messup of code blocks.
Here's the original code
{{{
inline int atomic_exchange_and_add( int * pw, int dv )
{
// int r = *pw;
// *pw += dv;
// return r;
int r;
__asm__ __volatile__
(
"lock\n\t"
"xadd %1, %0":
"=m"( *pw ), "=r"( r ): // outputs (%0, %1)
"m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
"memory", "cc" // clobbers
);
return r;
}
}}}
Here's the patches version
{{{
inline int atomic_exchange_and_add( int * pw, int dv )
{
// int r = *pw;
// *pw += dv;
// return r;
__asm__ __volatile__
(
"lock\n\t"
"xadd %1, %0":
"+m"( *pw ), "+r"( dv ): // input/output (%0, %1)
:
"memory", "cc" // clobbers
);
return dv;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10850#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC