Boost logo

Boost :

From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-04-26 13:42:19

----- Original Message -----
From: "Raoul Gough" <RaoulGough_at_[hidden]>
To: "Boost list" <boost_at_[hidden]>
Sent: Friday, April 26, 2002 12:14 PM
Subject: [boost] SEGV in condition_test_thread with cygwin/mingw32

> I've just managed to compile and link the release 1_27_0 boost threads
> library with gcc -mno-cygwin option under cygwin (i.e. mingw32) but
> test_thread crashes during exit from the function condition_test_thread. I
> had to fiddle a bit to get the boost libraries to compile and link, so I
> assume this is not a widely used platform (cygwin in mingw mode, boost
> 1_27_0 and STLport-4.5.3).

Actually, I do compile with this, so I'm a little surprised that you had to
make any changes to get it compiling. Well, to be precise, I compile with
the mingw compiler not the cygwin compiler, but I wouldn't expect there'd be
any differences here. So, I'd be interested in hearing what changes you had
to make and why.

That said, though I compile with this compiler I've yet to get the bugs
worked out. There are a few issues that I'm having problems diagnosing and
fixing, since I'm not a gcc user. The gdb output and other means of
diagnosing the problems have yet to enlighten me to the errors. If you've
got experience with these tools and can help to fix the bugs I'd be much

> Examining the assembler dump in gdb, the test seems to be crashing in some
> exception-handler-related code at the end of condition_test_thread:
> ----- Disassembly with added comments --------
> <condition_test_thread(void *)+222>:
> ;; data->awoken++; (last line of function)
> mov 0xfffffffc(%ebp),%eax
> incl 0x28(%eax)
> ;; Some kind of exception handler context stuff (?)
> lea 0x4(%ebx),%edx
> mov (%edx),%eax
> add $0x4,%eax
> mov (%eax),%edx
> mov (%edx),%ecx ;; <--- SEGV here, $edx is 0
> mov %ecx,(%eax)
> ;; boost::mutex::scoped_lock destructor stuff
> add $0xfffffff8,%esp
> push $0x2
> lea 0xffffffe0(%ebp),%eax
> push %eax
> call 0x40cde8 <_$_Q45boost6detail6threadt11scoped_lock1ZQ25boost5mutex>
> add $0x10,%esp
> ;; function exit stuff
> mov 0xffffffb8(%ebp),%ebx
> mov %ebp,%esp
> pop %ebp
> ret
> ----- End disassembly --------

I could be wrong, but this sounds like it's caused by not including
the -mthreads command option while compiling/linking. This was a problem in
the gcc-tools.jam at the time of release of Boost 1_27_0. I believe this
has been fixed in the current CVS snapshot, so I might suggest checking out
the latest stuff from CVS before attempting to debug any problems.

> Before I spend too long chasing this, has anybody else seen anything
> to this? Is anybody using the threads library with mingw and cygwin? I got
> pretty much exactly the same crash in my own test code as well.

Nobody is using it (unless they're either using pthreads-win32 or have fixed
the bugs with out reporting to me). But I'm very interested in getting
things to work for this compiler.

Bill Kempf

Boost list run by bdawes at, gregod at, cpdaniel at, john at