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:25:08 UTC

[jira] Closed: (STDCXX-70) std::string::operator+=(char) not thread-safe

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

    Resolution: Fixed

Fixed with  the referenced change.

> std::string::operator+=(char) not thread-safe
> ---------------------------------------------
>
>          Key: STDCXX-70
>          URL: http://issues.apache.org/jira/browse/STDCXX-70
>      Project: STDCXX
>         Type: Bug
>   Components: 21. Strings
>     Versions: 4.1.2
>  Environment: all
>     Reporter: Martin Sebor
>     Assignee: Martin Sebor
>     Priority: Blocker
>      Fix For: 4.1.3

>
> Discovered with SunPro 5.7 and reproducible also with SunPro 5.6 and gcc 3.4.3 but only on Solaris 10.
> $ cat t.cpp && nice gmake t && ./t
> #include <assert.h>
> #include <pthread.h>
> #include <string>
> const std::string str ("0123456789");
> const std::string expect = str + '*';
> extern "C" void* thread_func (void*)
> {
>     for (int i = 0; i < 100000; ++i) {
>         std::string s (str);
>         s += '*';
>         assert (s == expect);
>     }
>     return 0;
> }
> int main ()
> {
>     pthread_t tid [4];
>     unsigned i = 0;
>     for (i = 0; i != sizeof tid / sizeof *tid; ++i) {
>         if (pthread_create (tid + i, 0, thread_func, (void*)0))
>             return 1;
>     }
>     for (i = 0; i != sizeof tid / sizeof *tid; ++i) {
>         if (pthread_join (tid [i], 0))
>             return 2;
>     }
> }
> CC -c -D_RWSTDDEBUG   -mt -D_RWSTD_USE_CONFIG -I/build/sebor/sunpro-5.7.j4-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include  -library=%none -g  +w  t.cpp
> CC t.o -o t -library=%none -L/build/sebor/sunpro-5.7.j4-15s/lib  -mt  -L/build/sebor/sunpro-5.7.j4-15s/lib -lstd15s   -lm
> Assertion failed: s == expect, file t.cpp, line 13
> Assertion failed: s == expect, file t.cpp, line 13
> Assertion failed: s == expect, file t.cpp, line 13
> Abort (core dumped)

-- 
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