From: JonY <10...@gm...> - 2008-05-28 16:03:50
|
Hi, I'm using a native gcc 4.2.1-dw2 (mingw32-2) on a Win XP machine to run the attached code. It works without any problems with static libgcc but not with the shared libgcc. The test case is using shared pthreads. It segfaults with multiple threads, but runs if a single thread is used. I am unsure where the issue lies. Pass the number of threads to use as the first CLI parameter, eg "a.exe 3" for 3 threads. Same code works without an issue under Linux. Below is the GDB backtrace: Program received signal SIGSEGV, Segmentation fault. [Switching to thread 3624.0xfd0] pthread_mutex_lock (mutex=0x2c) at pthread_mutex_lock.c:52 52 if (*mutex == NULL) (gdb) bt #0 pthread_mutex_lock (mutex=0x2c) at pthread_mutex_lock.c:52 #1 0x00401b24 in gomp_mutex_lock (mutex=0x16) at ../gcc-4.2.1-2-src2/libgomp/config/posix/mutex.h:47 #2 0x00401c08 in gomp_barrier_wait (barrier=0x2c) at ../gcc-4.2.1-2-src2/libgomp/config/posix/bar.h:59 #3 0x004017bd in gomp_thread_start (xdata=0x22fe40) at ../gcc-4.2.1-2-src2/libgomp/team.c:121 #4 0x624838a4 in ptw32_threadStart@4 (vthreadParms=0x3e2e60) at ptw32_threadStart.c:219 #5 0x77c3a3b0 in msvcrt!_endthreadex () from C:\WINDOWS\system32\msvcrt.dll #6 0x7c80b713 in KERNEL32!GetModuleFileNameA () from C:\WINDOWS\system32\kernel32.dll #7 0x00000000 in ?? () (gdb) list 47 pthread_mutex_t mx; 48 49 /* 50 * Let the system deal with invalid pointers. 51 */ 52 if (*mutex == NULL) 53 { 54 return EINVAL; 55 } 56 (gdb) print mutex $1 = (pthread_mutex_t *) 0x2c Looks like a bad pointer, I've investigated up to frame 3, but still unsure how "0x2c" comes about. Any ideas why static libgcc version works but not the shared version? |