This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++, generic locale configuration, and c++0x


On Sun, Jun 6, 2010 at 12:03 PM, Paolo Carlini <pcarlini@gmail.com> wrote:
>
>> Before I entered a bug I wanted to see if I am actually interpreting
>> this correctly.
>
> Assuming you are, the issue doesn't qualify for Bugzilla, because nobody
> claims to have implemented this section of c++0x.
>
> Paolo

Well, it doesn't look like anyone can ever claim to have "implemented"
the section I pointed out, since this section is requirements on the
library itself.

Regardless, it therefore seems that the claims of thread safety in the
libstdc++ manual are misleading at best and patently false at worst
for any implementation excepting for glibc. The data race exists in
the generic implementation regardless of the platform.  This means
that if the program is running in a locale that uses ',' as a radix
character, you can have unknown results if multiple threads attempt to
do:

 strstream iss ("111,111 222,222 333,333");
 float f;
 iss >> f;  // the values of f can be undetermined due to race with
setlocale and strtod
               // crash can occur due to race between time of
setlocale(LC_ALL, NULL) and memcpy to save it.


So...would you consider this a bug in the documentation, or a bug in
the library?  And even if it's a bug in the documentation, it will
eventually have to be fixed for c++0x, yes?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]