This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/21334] Lack of Posix compliant thread safety in std::basic_string
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 May 2012 15:54:05 +0000
- Subject: [Bug libstdc++/21334] Lack of Posix compliant thread safety in std::basic_string
- Auto-submitted: auto-generated
- References: <bug-21334-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334
--- Comment #45 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-31 15:54:05 UTC ---
Thanks for the patch, I'll take a look asap.
Just to answer this older comment ...
(In reply to comment #35)
> Who said that calling begin() on a non const std::string should be thread safe
> ?
For the record, as it hasn't been mentioned here explicitly, C++11 says it:
23.2.2 Container data races [container.requirements.dataraces]
-1- For purposes of avoiding data races (17.6.5.9), implementations shall
consider the following functions to be const: begin, end, rbegin, rend, front,
back, data, find, lower_bound, upper_bound, equal_range, at and, except in
associative or unordered associative containers, operator[].
So in C++11 this is definitely a bug (but then a COW string is non-conforming
in other ways too, which is why it will go away when the ABI is changed.)