Mac 10.10.3 x64, crash with EXC_I386_GPFLT

Dear MacExperts,
we have a strange crash with a user code on MAC:
SoftwareVersion
ProductVersion: 10.10.3

g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.3.0

ROOT 5.34.34

Here the output of lldb:

>>>>>> GamsAnalyze, OpenRootFile run064.root
Process 4780 stopped
* thread #1: tid = 0x57ec6, 0x000000010136fffc libCint.so`Cint::G__CallFunc::G__CallFunc() + 124, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x000000010136fffc libCint.so`Cint::G__CallFunc::G__CallFunc() + 124
libCint.so`Cint::G__CallFunc::G__CallFunc() + 124:
-> 0x10136fffc:  movaps %xmm3, 0x100(%rbx)
   0x101370003:  movaps %xmm2, 0xf0(%rbx)
   0x10137000a:  movaps %xmm1, 0xe0(%rbx)
   0x101370011:  movaps %xmm0, 0xd0(%rbx)
(lldb) bt
* thread #1: tid = 0x57ec6, 0x000000010136fffc libCint.so`Cint::G__CallFunc::G__CallFunc() + 124, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x000000010136fffc libCint.so`Cint::G__CallFunc::G__CallFunc() + 124
    frame #1: 0x0000000100f4a10c libCore.so`TCint::CallFunc_Factory() const + 28
    frame #2: 0x0000000100f535f4 libCore.so`TClass::CallShowMembers(void*, TMemberInspector&, int) const + 324
    frame #3: 0x0000000100f4ea70 libCore.so`TClass::BuildRealData(void*, bool) + 768
    frame #4: 0x0000000100f4e566 libCore.so`TBuildRealData::Inspect(TClass*, char const*, char const*, void const*) + 1142
    frame #5: 0x0000000100cb88d3 libCore.so`TNamed::ShowMembers(TMemberInspector&) + 83
    frame #6: 0x0000000100f53541 libCore.so`TClass::CallShowMembers(void*, TMemberInspector&, int) const + 145
    frame #7: 0x0000000100f4ea70 libCore.so`TClass::BuildRealData(void*, bool) + 768
    frame #8: 0x0000000101aa9790 libRIO.so`TBufferFile::ReadClassBuffer(TClass const*, void*, TClass const*) + 784
    frame #9: 0x0000000101b091ee libRIO.so`TStreamerInfo::Streamer(TBuffer&) + 894
    frame #10: 0x0000000101aa6eed libRIO.so`TBufferFile::ReadObjectAny(TClass const*) + 989
    frame #11: 0x0000000100f25e1f libCore.so`TList::Streamer(TBuffer&) + 479
    frame #12: 0x0000000101aecf16 libRIO.so`TKey::ReadObjWithBuffer(char*) + 950
    frame #13: 0x0000000101ab9c79 libRIO.so`TFile::GetStreamerInfoList() + 329
    frame #14: 0x0000000101ac219d libRIO.so`TFile::ReadStreamerInfo() + 29
    frame #15: 0x0000000101ab7ea4 libRIO.so`TFile::Init(bool) + 1156
    frame #16: 0x0000000101ab7473 libRIO.so`TFile::TFile(char const*, char const*, char const*, int) + 2227
    frame #17: 0x0000000100372be0 libGamsAnalyze.so`TMrbAnalyze::OpenRootFile(this=0x000000010302d808, IOSpec=0x0000000104189158) + 1472 at GamsAnalyze.cxx:373
    frame #18: 0x0000000100025276 libTMrbAnalyze.so`TMrbAnalyze::ProcessFileList(this=0x000000010302d808) + 406 at TMrbAnalyze.cxx:506
    frame #19: 0x0000000100005a9e M_analyze`main(argc=<unavailable>, argv=<unavailable>) + 16366 at M_analyze.cxx:536
    frame #20: 0x00007fff861515c9 libdyld.dylib`start + 1

Note the BAD_ACCESS happens in libCint.so with code=EXC_I386_GPFLT
All was build with m64.
If I open the same file with ROOT which uses the same libs (libCint.so)
it works fine.

Here the linker command:

gar-ws-juliet:gams otto.schaile$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.3.0

g++ -dynamiclib -single_module -undefined dynamic_lookup -Wl,-dead_strip_dylibs -Wl,-rpath /Volumes/Otto.Schaile/marabou_mac/gams/ GamsAnalyze.o GamsAnalyzeDict.o Initialize.o Analyze.o Analyze_Xstop.o -o libGamsAnalyze.so
g++  -g -m64 -mmacosx-version-min=10.10  -o M_analyze /Volumes/Otto.Schaile/marabou_mac/marabou/obj/M_analyze.o \
					-L/Volumes/Otto.Schaile/marabou_mac/marabou/lib -lTMrbAnalyze -lTMrbTransport -lTMrbUtils -lMutex \
					/Volumes/Otto.Schaile/marabou_mac/gams/libGamsAnalyze.so \
					-L/Volumes/Otto.Schaile/root_mac/5.34.34/lib -lGraf -L/Volumes/Otto.Schaile/root_mac/5.34.34/lib -lNew -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -stdlib=libc++ -lm -ldl

Info about libCint.so:

gar-ws-juliet:gams otto.schaile$ otool -L /Volumes/Otto.Schaile/root_mac/5.34.34/lib/libCint.so 
/Volumes/Otto.Schaile/root_mac/5.34.34/lib/libCint.so:
	@rpath/libCint.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

gar-ws-juliet:gams otto.schaile$ file /Volumes/Otto.Schaile/root_mac/5.34.34/lib/libCint.so
/Volumes/Otto.Schaile/root_mac/5.34.34/lib/libCint.so: Mach-O 64-bit dynamically linked shared library x86_64

I should point out I am n o t member of group MacExperts
Same happens on El Capitan

Any hint/help would be appreciated
Otto

Hi Otto,

There seems to be two threads attempting to do I/O at the same time. In order to properly support this, in v5.34 (and actually anything older than v6.06), you need to create a TThread object per thread. You should also call TThread::Initialize (It is optional in v5.34 since it is triggered by the creation of the TThread object).

Cheers,
Philippe.