This is the mail archive of the gcc-bugs@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]

RE: STL, string bug


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



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