Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Multi-threaded application SEGV pthread_exit question

postaquestion
Beginner
431 Views

We are using a multithreaded application on the following configuration and persistently getting a SEGV in the pthread_exit () system call. (stack below). The SEGV disappears when a lower optimization level "-O1" is used,
but is seen with the default optimization level "-O"

OS : Linux 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:29:47 EST 2005 x86_64 x86_64 x86_64 GNU/Linux

Compiler : Intel C++ Compiler for applications running on Intel 64, Version 10.0 Build 20070426 Package ID: l_cc_p_10.0.023


Compiler flags used :

icpc -I. -I../h -I../sl -I../om/h -I../sm/h -Ichk/ -O -c -D_REENTRANT -DVS_USE_64_CALLS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fpic -Wp64 -Wall -nolib_inline -gcc-version=343 -fno-fnalias -static-libcxa


Stack :

==========
[New Thread 1074538848 (LWP 14545)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1074538848 (zombie)]
0x00000039ea005156 in _Unwind_GetRegionStart () from /lib64/libgcc_s.so.1
(gdb) where
#0 0x00000039ea005156 in _Unwind_GetRegionStart () from /lib64/libgcc_s.so.1
#1 0x00000039ea005c64 in _Unwind_FindEnclosingFunction () from /lib64/libgcc_s.so.1
#2 0x00000039ea006827 in _Unwind_RaiseException () from /lib64/libgcc_s.so.1
#3 0x00000039ea00691c in _Unwind_ForcedUnwind () from /lib64/libgcc_s.so.1
#4 0x00000039e8a0ac70 in __pthread_unwind () from /lib64/tls/libpthread.so.0
#5 0x00000039e8a06e65 in pthread_exit () from /lib64/tls/libpthread.so.0
#6 0x00000000006dadfc in vs_thrExit ()
#7 0x000000000040c889 in obe_thread ()
#8 0x00000039e8a0613a in start_thread () from /lib64/tls/libpthread.so.0
#9 0x00000039e81c52b3 in clone () from /lib64/tls/libc.so.6
#10 0x0000000000000000 in ?? ()
==========

What could be the potential reasons for the SEGV to come in the func. "_Unwind_GetRegionStart"? Are there any compiler flags that could be of use?

Any pointers would be helpful.

0 Kudos
2 Replies
TimP
Honored Contributor III
431 Views
It may be worth while to try a current compiler. The only compile flag which means anything to me which may be suspect is -fno-fnalias; it may enable an optimization which breaks your code. Grasping at further straws, you might try -fno-inline-functions, but that's a wild guess. You didn't say whether you have OpenMP threading or direct pthread calls, which would put it out of my league.

0 Kudos
djambhale
Beginner
431 Views

Hi,

Thanks for the suggestions. We are using pthreads in our code. I gave a shot by :

1. Adding -fno-inline-functions AND

2. Removing -fno-fnalias .. without luck though.

Finally one compiler option worked for us : ie: "-fno-exceptions"

This disables the exception handling in a C code by the compiler. By default this option was getting turned ON in our case becasue of usinga C++ compiler on a C code. However, no exception handling was warranted in the C source code so disabling this option, (which the compiler would have anyways done for a C code) resolved the pthread_unwind SEGV.

0 Kudos
Reply