This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: "Interesting" behavior in std::locale
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: James Benze <benzejaa at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 31 Oct 2014 19:53:33 +0000
- Subject: Re: "Interesting" behavior in std::locale
- Authentication-results: sourceware.org; auth=none
- References: <CAFCb1eYNzFi3_1sCfirFWRFTezJv4VWURsOFPHrh-R0QLJ+pbQ at mail dot gmail dot com>
On 31/10/14 12:07 -0400, James Benze wrote:
I found this code because helgrind (valgrind's data-race finder) lit
up like a lightbulb with all these placement-new calls to the same
array. It's obviously safe...the locale returned by
std::locale::classic is guaranteed never to change so it's essentially
just writing the same chunk of memory over and over.
N.B. you need to rebuild the library with some helgrind annotations to
remove some false positives in the locale::_Impl code, see
https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug.html#debug.races
There may be other real races that helgind finds though.