STL, string bug
Beardsley, Jason
jbeardsley@origin.ea.com
Tue Apr 27 13:39:00 GMT 1999
> > The problem is, apparently, the <string> implementation provided
> > with egcs is not multithreaded-safe.
>
> You may have to compile with -D_PTHREADS
Tried that, nothing changed. I define _REENTRANT, _PTHREADS, and
__STL_PTHREADS in the source, but it still dumps core when executed.
Note that it does run for a short time before crashing. If I don't
define __STL_PTHREADS/_PTHREADS, it crashes immediately.
Gdb hows that it crashes at stl_alloc.h:422, the line is
*__my_free_list = __result -> _M_free_list_link;
and __result is "(union _Obj *) 0xb", which definitely doesn't look
like a valid pointer. How it gets into this state is what I couldn't
figure out. Single-stepping doesn't help much in this situation.
The reason I think it's in <string>, and not in the allocator, is that
replacing the list<string> with a list<int> results in a working
program. That could be a faulty assumption, though. Maybe it is a
problem with the allocator, and only shows up when using lists of
non-builtin types, large objects, or something along those lines.
Jason Beardsley
jbeardsley@origin.ea.com
More information about the Gcc-bugs
mailing list