Segmentation fault with LD on Xcode 8.3 beta 3

Originator:macmade
Number:rdar://30763552 Date Originated:28-Feb-2017 08:52 PM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Crash/Hang/Data Loss Reproducible:Always
 
LD crashes with a segmentation fault when trying to link a macOS framework target.

> clang: error: unable to execute command: Segmentation fault: 11
> clang: error: linker command failed due to signal (use -v to see invocation)

Full LD invocation can be found in the attached crash report.

--------------------------------------------------------------------------------

I cannot attach the project that fails, as it's proprietary code.

The project is quite complex and huge, mixing C, C++ and Objective-C, with many external static libraries.

The crash occurs every time.
Based on the crash stack trace, I also tried to modify the LTO options with every possible value (none, incremental, monolithic), but LD still crashes.

Note that Xcode 8.2.1 works just fine...

--------------------------------------------------------------------------------

Crash always occurs on Xcode 8.3 betas...

--------------------------------------------------------------------------------

macOS 10.12.3 Beta (16D25a)
Xcode 8.3 beta 3 (8W132p)

--------------------------------------------------------------------------------

Process:               ld [80919]
Path:                  /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
Identifier:            ld
Version:               278.4
Code Type:             X86-64 (Native)
Parent Process:        clang [80918]
Responsible:           ld [80919]
User ID:               501

Date/Time:             2017-02-28 20:38:57.859 +0100
OS Version:            Mac OS X 10.12.3 (16D25a)
Report Version:        12
Anonymous UUID:        B16B2A76-C498-F807-4AE4-15EDB29066CB

Sleep/Wake UUID:       B474545C-9CEC-4A37-8907-FCD9960684A6

Time Awake Since Boot: 89000 seconds
Time Since Wake:       2200 seconds

System Integrity Protection: disabled

Crashed Thread:        4

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0:
--> 
    __TEXT                 0000000105811000-0000000105917000 [ 1048K] r-x/rwx SM=COW  /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fffaa518fda __semwait_signal + 10
1   libsystem_pthread.dylib       	0x00007fffaa603855 pthread_join + 425
2   libc++.1.dylib                	0x00007fffa8fc94b7 std::__1::thread::join() + 23
3   libLTO.dylib                  	0x000000011c4a28c8 llvm::ThreadPool::~ThreadPool() + 88
4   libLTO.dylib                  	0x000000011c3d0205 llvm::ThinLTOCodeGenerator::run() + 6693
5   ld                            	0x000000010586e12f lto::Parser::optimizeThinLTO(std::__1::vector<lto::File*, std::__1::allocator<lto::File*> > const&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 815
6   ld                            	0x000000010586eb80 lto::Parser::optimize(std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 412
7   ld                            	0x000000010586f296 lto::optimize(std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 72
8   ld                            	0x000000010588afa3 ld::tool::Resolver::linkTimeOptimize() + 525
9   ld                            	0x000000010588b507 ld::tool::Resolver::resolve() + 151
10  ld                            	0x0000000105832289 main + 725
11  libdyld.dylib                 	0x00007fffaa3ea255 start + 1

Thread 1:
0   libsystem_kernel.dylib        	0x00007fffaa5193b2 __ulock_wait + 10
1   libsystem_platform.dylib      	0x00007fffaa5fab5f _os_ulock_wait + 25
2   libsystem_platform.dylib      	0x00007fffaa5fa432 _os_unfair_lock_lock_slow + 130
3   libsystem_malloc.dylib        	0x00007fffaa583f6d free_tiny + 343
4   libLTO.dylib                  	0x000000011c357d48 llvm::LLVMContextImpl::~LLVMContextImpl() + 3496
5   libLTO.dylib                  	0x000000011c3d4e2a std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 8954
6   libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
7   libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
8   libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
9   libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 2:
0   libsystem_malloc.dylib        	0x00007fffaa5840c9 free_tiny + 691
1   libLTO.dylib                  	0x000000011c86bf89 unsigned int llvm::DFSPass<llvm::GraphTraits<llvm::MachineBasicBlock*> >(llvm::DominatorTreeBase<llvm::GraphTraits<llvm::MachineBasicBlock*>::NodeType>&, llvm::GraphTraits<llvm::MachineBasicBlock*>::NodeType*, unsigned int) + 489
2   libLTO.dylib                  	0x000000011c869e47 void llvm::Calculate<llvm::MachineFunction, llvm::MachineBasicBlock*>(llvm::DominatorTreeBase<llvm::GraphTraits<llvm::MachineBasicBlock*>::NodeType>&, llvm::MachineFunction&) + 2167
3   libLTO.dylib                  	0x000000011c867392 void llvm::DominatorTreeBase<llvm::MachineBasicBlock>::recalculate<llvm::MachineFunction>(llvm::MachineFunction&) + 114
4   libLTO.dylib                  	0x000000011c8672cf llvm::MachineDominatorTree::runOnMachineFunction(llvm::MachineFunction&) + 63
5   libLTO.dylib                  	0x000000011c873670 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 112
6   libLTO.dylib                  	0x000000011c3653de llvm::FPPassManager::runOnFunction(llvm::Function&) + 574
7   libLTO.dylib                  	0x000000011c365853 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
8   libLTO.dylib                  	0x000000011c365b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 489
9   libLTO.dylib                  	0x000000011c3ce6d3 (anonymous namespace)::codegenModule(llvm::Module&, llvm::TargetMachine&) + 499
10  libLTO.dylib                  	0x000000011c3d45fc std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 6860
11  libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
12  libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
13  libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
14  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 3:
0   libLTO.dylib                  	0x000000011c385dd0 llvm::AnalysisUsage::setPreservesCFG() + 144
1   libLTO.dylib                  	0x000000011c7cf345 (anonymous namespace)::DetectDeadLanes::getAnalysisUsage(llvm::AnalysisUsage&) const + 21
2   libLTO.dylib                  	0x000000011c35f648 llvm::PMTopLevelManager::findAnalysisUsage(llvm::Pass*) + 264
3   libLTO.dylib                  	0x000000011c360125 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 117
4   libLTO.dylib                  	0x000000011c99c325 llvm::TargetPassConfig::addPass(llvm::Pass*, bool, bool) + 437
5   libLTO.dylib                  	0x000000011c99c544 llvm::TargetPassConfig::addPass(void const*, bool, bool) + 148
6   libLTO.dylib                  	0x000000011c99da83 llvm::TargetPassConfig::addOptimizedRegAlloc(llvm::FunctionPass*) + 35
7   libLTO.dylib                  	0x000000011c99d290 llvm::TargetPassConfig::addMachinePasses() + 560
8   libLTO.dylib                  	0x000000011c83e473 addPassesToGenerateCode(llvm::LLVMTargetMachine*, llvm::legacy::PassManagerBase&, bool, void const*, void const*, void const*, llvm::MachineFunctionInitializer*) + 963
9   libLTO.dylib                  	0x000000011c83db42 llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::TargetMachine::CodeGenFileType, bool, void const*, void const*, void const*, llvm::MachineFunctionInitializer*) + 66
10  libLTO.dylib                  	0x000000011c3ce6bb (anonymous namespace)::codegenModule(llvm::Module&, llvm::TargetMachine&) + 475
11  libLTO.dylib                  	0x000000011c3d45fc std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 6860
12  libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
13  libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
14  libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
15  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 4 Crashed:
0   libLTO.dylib                  	0x000000011ccd5341 llvm::FunctionImportGlobalProcessing::processGlobalForThinLTO(llvm::GlobalValue&) + 657
1   libLTO.dylib                  	0x000000011ccd58d3 llvm::FunctionImportGlobalProcessing::processGlobalsForThinLTO() + 51
2   libLTO.dylib                  	0x000000011c3d40a4 std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 5492
3   libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
4   libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
5   libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
6   libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 5:
0   libLTO.dylib                  	0x000000011cd67dad (anonymous namespace)::MDNodeMapper::getMappedOp(llvm::Metadata const*) const + 45
1   libLTO.dylib                  	0x000000011cd673f5 (anonymous namespace)::MDNodeMapper::mapTopLevelUniquedNode(llvm::MDNode const&) + 2901
2   libLTO.dylib                  	0x000000011cd6608d (anonymous namespace)::Mapper::mapMetadata(llvm::Metadata const*) (.llvm.4E7E6D39) + 1021
3   libLTO.dylib                  	0x000000011cc3baa1 llvm::IRMover::move(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >, llvm::ArrayRef<llvm::GlobalValue*>, std::__1::function<void (llvm::GlobalValue&, std::__1::function<void (llvm::GlobalValue&)>)>, bool, bool) + 11425
4   libLTO.dylib                  	0x000000011cc440eb llvm::Linker::linkInModule(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >, unsigned int, llvm::DenseSet<llvm::GlobalValue const*, llvm::DenseMapInfo<llvm::GlobalValue const*> >*) + 4747
5   libLTO.dylib                  	0x000000011ca0ff70 llvm::FunctionImporter::importFunctions(llvm::Module&, llvm::StringMap<std::__1::map<unsigned long long, unsigned int, std::__1::less<unsigned long long>, std::__1::allocator<std::__1::pair<unsigned long long const, unsigned int> > >, llvm::MallocAllocator> const&, bool) + 3520
6   libLTO.dylib                  	0x000000011c3d41d8 std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 5800
7   libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
8   libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
9   libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
10  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 6:
0   libsystem_kernel.dylib        	0x00007fffaa5193b2 __ulock_wait + 10
1   libsystem_platform.dylib      	0x00007fffaa5fab5f _os_ulock_wait + 25
2   libsystem_platform.dylib      	0x00007fffaa5fa432 _os_unfair_lock_lock_slow + 130
3   libsystem_malloc.dylib        	0x00007fffaa57a99c free_small + 151
4   libLTO.dylib                  	0x000000011cd7a183 llvm::BasicAAWrapperPass::runOnFunction(llvm::Function&) + 1427
5   libLTO.dylib                  	0x000000011c3653de llvm::FPPassManager::runOnFunction(llvm::Function&) + 574
6   libLTO.dylib                  	0x000000011c365853 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
7   libLTO.dylib                  	0x000000011c365b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 489
8   libLTO.dylib                  	0x000000011c3d44c5 std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 6549
9   libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
10  libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
11  libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
12  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 7:
0   libsystem_malloc.dylib        	0x00007fffaa56ce70 szone_malloc_should_clear + 2870
1   libsystem_malloc.dylib        	0x00007fffaa56c2da malloc_zone_malloc + 107
2   libsystem_malloc.dylib        	0x00007fffaa56b258 malloc + 24
3   libc++abi.dylib               	0x00007fffa8ffbe2e operator new(unsigned long) + 30
4   libc++.1.dylib                	0x00007fffa8fbe3f0 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long) + 66
5   libLTO.dylib                  	0x000000011ce07819 (anonymous namespace)::LazyValueInfoCache::intersectAssumeOrGuardBlockValueConstantRange(llvm::Value*, (anonymous namespace)::LVILatticeVal&, llvm::Instruction*) (.llvm.ADFE2466) + 137
6   libLTO.dylib                  	0x000000011ce05e2c llvm::LazyValueInfo::getPredicateAt(unsigned int, llvm::Value*, llvm::Constant*, llvm::Instruction*) + 300
7   libLTO.dylib                  	0x000000011ca9617b llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*) + 1051
8   libLTO.dylib                  	0x000000011ca957a9 llvm::JumpThreadingPass::runImpl(llvm::Function&, llvm::TargetLibraryInfo*, llvm::LazyValueInfo*, bool, std::__1::unique_ptr<llvm::BlockFrequencyInfo, std::__1::default_delete<llvm::BlockFrequencyInfo> >, std::__1::unique_ptr<llvm::BranchProbabilityInfo, std::__1::default_delete<llvm::BranchProbabilityInfo> >) + 281
9   libLTO.dylib                  	0x000000011caa04ae (anonymous namespace)::JumpThreading::runOnFunction(llvm::Function&) + 302
10  libLTO.dylib                  	0x000000011c3653de llvm::FPPassManager::runOnFunction(llvm::Function&) + 574
11  libLTO.dylib                  	0x000000011cda4ac8 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 1800
12  libLTO.dylib                  	0x000000011c365b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 489
13  libLTO.dylib                  	0x000000011c3d44c5 std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 6549
14  libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
15  libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
16  libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
17  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 8:
0   libLTO.dylib                  	0x000000011c37a121 llvm::Instruction::getMetadataImpl(unsigned int) const + 1
1   libLTO.dylib                  	0x000000011c3a8f7a (anonymous namespace)::Verifier::visitInstruction(llvm::Instruction&) + 7818
2   libLTO.dylib                  	0x000000011c399a9b llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit(llvm::Function&) + 4011
3   libLTO.dylib                  	0x000000011c395757 (anonymous namespace)::Verifier::verify(llvm::Function const&) + 199
4   libLTO.dylib                  	0x000000011c3b4cc2 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 18
5   libLTO.dylib                  	0x000000011c3653de llvm::FPPassManager::runOnFunction(llvm::Function&) + 574
6   libLTO.dylib                  	0x000000011c365853 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
7   libLTO.dylib                  	0x000000011c365b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 489
8   libLTO.dylib                  	0x000000011c3d44c5 std::__1::__function::__func<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&>, std::__1::allocator<std::__1::__bind<llvm::ThinLTOCodeGenerator::run()::$_5, int&> >, void ()>::operator()() + 6549
9   libLTO.dylib                  	0x000000011c4a2d68 std::__1::__thread_proxy<std::__1::tuple<llvm::ThreadPool::ThreadPool(unsigned int)::$_0> >(void*, void*) + 680
10  libsystem_pthread.dylib       	0x00007fffaa601aab _pthread_body + 180
11  libsystem_pthread.dylib       	0x00007fffaa6019f7 _pthread_start + 286
12  libsystem_pthread.dylib       	0x00007fffaa6011fd thread_start + 13

Thread 4 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0xd9514001dec603a9  rcx: 0x0000000000000000  rdx: 0x0000000000276140
  rdi: 0x0000000000041600  rsi: 0x00007fbb8e800000  rbp: 0x000070000e142ae0  rsp: 0x000070000e142950
   r8: 0x0000000000000006   r9: 0x0000000000000000  r10: 0x0000000000000001  r11: 0x0000000000000007
  r12: 0x000070000e142d70  r13: 0x0000000000000101  r14: 0x00007fbb8fcf76a8  r15: 0x00007fbb8e266818
  rip: 0x000000011ccd5341  rfl: 0x0000000000010202  cr2: 0x0000000000000000
  
Logical CPU:     6
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x105811000 -        0x105916fff +ld (278.4) <FF67106A-BC55-3E89-B517-DB019E5765F9> /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
       0x1059c2000 -        0x105a31ff3 +libtapi.dylib (1.33.8) <0C6C0EDF-98B4-3B9F-B622-357D89EED34E> /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libtapi.dylib
       0x105c61000 -        0x105c9e267  dyld (421.2) <947FC440-80F9-32F7-A773-6FC418FE1AB7> /usr/lib/dyld
       0x11bd19000 -        0x11d43bfff +libLTO.dylib (802.0.35) <C5B0AAC3-F3C0-3B43-8A8D-483A44AA5B7B> /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib
    0x7fffa8e47000 -     0x7fffa8e48ff3  libSystem.B.dylib (1238) <9CB018AF-54E9-300F-82BE-81FE553C9154> /usr/lib/libSystem.B.dylib
    0x7fffa8f60000 -     0x7fffa8f60ff3  libauto.dylib (187) <5BBF6A00-CC76-389D-84E7-CA88EDADE683> /usr/lib/libauto.dylib
    0x7fffa8f72000 -     0x7fffa8f80ff7  libbz2.1.0.dylib (38) <6FD3B63F-0F86-3A25-BD5B-E243F58792C9> /usr/lib/libbz2.1.0.dylib
    0x7fffa8f81000 -     0x7fffa8fd7ff7  libc++.1.dylib (307.4) <BEE86868-F831-384C-919E-2B286ACFE87C> /usr/lib/libc++.1.dylib
    0x7fffa8fd8000 -     0x7fffa9002fff  libc++abi.dylib (307.2) <1CEF8ABB-7E6D-3C2F-8E0A-E7884478DD23> /usr/lib/libc++abi.dylib
    0x7fffa9540000 -     0x7fffa9765ffb  libicucore.A.dylib (57149.0.1) <6B5FDA93-AA88-318F-9608-C2A33D602EC7> /usr/lib/libicucore.A.dylib
    0x7fffa976d000 -     0x7fffa9786ffb  liblzma.5.dylib (10) <44BD0279-99DD-36B5-8A6E-C11432E2098D> /usr/lib/liblzma.5.dylib
    0x7fffa9a46000 -     0x7fffa9a77ffb  libncurses.5.4.dylib (51.30.1) <A8C8F837-86A2-3EC2-B2D2-6E8A267847E4> /usr/lib/libncurses.5.4.dylib
    0x7fffa9af2000 -     0x7fffa9ec2d97  libobjc.A.dylib (706) <F9AFE665-A3A2-3285-9495-19803A565861> /usr/lib/libobjc.A.dylib
    0x7fffaa1c1000 -     0x7fffaa1cefff  libxar.1.dylib (357) <58BFB84B-66FE-3299-AA3D-BBA178ADEE39> /usr/lib/libxar.1.dylib
    0x7fffaa1d2000 -     0x7fffaa2c1ffb  libxml2.2.dylib (30.11) <E12AF929-0FA5-3214-840F-C81E6AC9F36E> /usr/lib/libxml2.2.dylib
    0x7fffaa2ec000 -     0x7fffaa2fdff3  libz.1.dylib (67) <46E3FFA2-4328-327A-8D34-A03E20BFFB8E> /usr/lib/libz.1.dylib
    0x7fffaa30c000 -     0x7fffaa310ff7  libcache.dylib (79) <0C8092D3-600F-3ADD-A036-F225B6CDCA43> /usr/lib/system/libcache.dylib
    0x7fffaa311000 -     0x7fffaa31cff7  libcommonCrypto.dylib (60092.30.2) <B16E29B6-EC8D-3A8F-9A89-DD9CF35F7C4B> /usr/lib/system/libcommonCrypto.dylib
    0x7fffaa31d000 -     0x7fffaa324fff  libcompiler_rt.dylib (62) <E992E8D9-037C-3454-A366-A25E4D31D6BB> /usr/lib/system/libcompiler_rt.dylib
    0x7fffaa325000 -     0x7fffaa32dfff  libcopyfile.dylib (138) <64E285D9-5485-333B-AEE7-8B0C8FB9275F> /usr/lib/system/libcopyfile.dylib
    0x7fffaa32e000 -     0x7fffaa3b1fdf  libcorecrypto.dylib (442.30.20) <2074B932-FD79-30A9-8E90-AF25C49F2AF1> /usr/lib/system/libcorecrypto.dylib
    0x7fffaa3b2000 -     0x7fffaa3e4fff  libdispatch.dylib (703.30.5) <EA0CC14E-D559-3802-B4B2-0E8C7579AAC4> /usr/lib/system/libdispatch.dylib
    0x7fffaa3e5000 -     0x7fffaa3eaff3  libdyld.dylib (421.2) <6452FD53-DEBB-35EF-9DBC-7C587AB3BF40> /usr/lib/system/libdyld.dylib
    0x7fffaa3eb000 -     0x7fffaa3ebffb  libkeymgr.dylib (28) <1A318923-1200-3B06-B432-5007D82F195D> /usr/lib/system/libkeymgr.dylib
    0x7fffaa3f9000 -     0x7fffaa3f9fff  liblaunch.dylib (972.30.7) <15FACC21-079A-3BDF-9AFB-4253EFDEB587> /usr/lib/system/liblaunch.dylib
    0x7fffaa3fa000 -     0x7fffaa3fffff  libmacho.dylib (894) <A2F38EC1-C37C-3B93-B0E4-36B07C177F8C> /usr/lib/system/libmacho.dylib
    0x7fffaa400000 -     0x7fffaa402ff3  libquarantine.dylib (85) <C1D7749F-5F5F-3BB9-BEFC-1F0B9DA941FD> /usr/lib/system/libquarantine.dylib
    0x7fffaa403000 -     0x7fffaa404ffb  libremovefile.dylib (45) <CD42974E-BE0B-39FC-9BFC-8A7540A04DC6> /usr/lib/system/libremovefile.dylib
    0x7fffaa405000 -     0x7fffaa41dff7  libsystem_asl.dylib (349.30.2) <EFAC72D7-CB13-3DF7-ADF3-EC6635C6F1EA> /usr/lib/system/libsystem_asl.dylib
    0x7fffaa41e000 -     0x7fffaa41eff7  libsystem_blocks.dylib (67) <B8C3701D-5A91-3D35-999D-2DC8D5393525> /usr/lib/system/libsystem_blocks.dylib
    0x7fffaa41f000 -     0x7fffaa4acfef  libsystem_c.dylib (1158.30.7) <2F881962-03CB-3B9D-A782-D98C1BBA4E3D> /usr/lib/system/libsystem_c.dylib
    0x7fffaa4ad000 -     0x7fffaa4b0ffb  libsystem_configuration.dylib (888.30.2) <4FE3983C-E4ED-3939-A578-03AD29C99788> /usr/lib/system/libsystem_configuration.dylib
    0x7fffaa4b1000 -     0x7fffaa4b4fff  libsystem_coreservices.dylib (41.4) <1A572B9E-0C47-320F-8C64-7990D0A5FB5A> /usr/lib/system/libsystem_coreservices.dylib
    0x7fffaa4b5000 -     0x7fffaa4cdff3  libsystem_coretls.dylib (121.31.1) <4676F06D-274D-31BE-B61C-4D7A4AEF4858> /usr/lib/system/libsystem_coretls.dylib
    0x7fffaa4ce000 -     0x7fffaa4d4fff  libsystem_dnssd.dylib (765.30.11) <DC708D84-ED7D-3936-B996-A67C66B8DDAA> /usr/lib/system/libsystem_dnssd.dylib
    0x7fffaa4d5000 -     0x7fffaa4feff7  libsystem_info.dylib (503.30.1) <9ED9121C-F111-3FAD-BC2F-C95DEE1C9362> /usr/lib/system/libsystem_info.dylib
    0x7fffaa4ff000 -     0x7fffaa521ff7  libsystem_kernel.dylib (3789.41.3) <B75B128C-7D7A-3318-91CD-82B5A69C5329> /usr/lib/system/libsystem_kernel.dylib
    0x7fffaa522000 -     0x7fffaa569fe7  libsystem_m.dylib (3121.4) <266DB92B-A86F-3691-80FB-1B26AD73CFF3> /usr/lib/system/libsystem_m.dylib
    0x7fffaa56a000 -     0x7fffaa588ff7  libsystem_malloc.dylib (116.30.3) <F40DEE3B-386A-3529-A3F7-98117ED55BF4> /usr/lib/system/libsystem_malloc.dylib
    0x7fffaa589000 -     0x7fffaa5e0ffb  libsystem_network.dylib (856.30.16) <4AE368E9-605D-379D-B04C-2AC7455B8250> /usr/lib/system/libsystem_network.dylib
    0x7fffaa5e1000 -     0x7fffaa5eaff3  libsystem_networkextension.dylib (563.30.15) <EB020B0C-7DF0-3EEF-8E3C-15DA3C01D687> /usr/lib/system/libsystem_networkextension.dylib
    0x7fffaa5eb000 -     0x7fffaa5f4ff3  libsystem_notify.dylib (165.20.1) <E7FD3A7C-DD07-36E2-9FA4-7561F9F114DA> /usr/lib/system/libsystem_notify.dylib
    0x7fffaa5f5000 -     0x7fffaa5fdfe7  libsystem_platform.dylib (126.1.2) <3CA06D4E-C00A-36DE-AA65-3A390097D1F6> /usr/lib/system/libsystem_platform.dylib
    0x7fffaa5fe000 -     0x7fffaa608ff7  libsystem_pthread.dylib (218.30.1) <C869ED7C-BE29-3532-8E69-3A8DA1447EDC> /usr/lib/system/libsystem_pthread.dylib
    0x7fffaa609000 -     0x7fffaa60cff7  libsystem_sandbox.dylib (592.31.1) <7BBFDF96-293F-3DD9-B3A4-7C168280B441> /usr/lib/system/libsystem_sandbox.dylib
    0x7fffaa60d000 -     0x7fffaa60efff  libsystem_secinit.dylib (24) <5C1F1E47-0F7D-3E25-8DEB-D9DB1F902281> /usr/lib/system/libsystem_secinit.dylib
    0x7fffaa60f000 -     0x7fffaa616fff  libsystem_symptoms.dylib (532.30.6) <145C2AD9-4DAD-3F58-AD22-60DFFD8F13FF> /usr/lib/system/libsystem_symptoms.dylib
    0x7fffaa617000 -     0x7fffaa637ff7  libsystem_trace.dylib (518.30.7) <6D34D1EA-2A3C-3D2D-803E-A666E6AEEE52> /usr/lib/system/libsystem_trace.dylib
    0x7fffaa638000 -     0x7fffaa63dffb  libunwind.dylib (35.3) <9F7C2AD8-A9A7-3DE4-828D-B0F0F166AAA0> /usr/lib/system/libunwind.dylib
    0x7fffaa63e000 -     0x7fffaa667ff7  libxpc.dylib (972.30.7) <65E41BB6-EBD5-3D93-B0BE-B190CEE4DD93> /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 1163934
    thread_create: 0
    thread_set_state: 4525

VM Region Summary:
ReadOnly portion of Libraries: Total=150.6M resident=0K(0%) swapped_out_or_unallocated=150.6M(100%)
Writable regions: Total=258.2M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=258.2M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        2 
MALLOC                           245.8M       99 
MALLOC guard page                   16K        4 
STACK GUARD                       56.0M       10 
Stack                             12.1M       10 
VM_ALLOCATE                          4K        2 
__DATA                            3516K       54 
__LINKEDIT                       114.5M        6 
__TEXT                            36.1M       51 
mapped file                      337.5M       80 
shared memory                       20K        5 
===========                     =======  ======= 
TOTAL                            805.5M      312

Comments

All right, so the issue is still present with Xcode 9 beta (9M136h).

The good news is I’ve been able to reproduce the issue on a test project (attached here).

I’m not really sure what triggers the crash. Project setup is a bit weird, with some third-party code (libgpod) compiled to a framework inside another framework.

Also, this third-party library depends on glib, and as it’s a real pain to compile, we decided to reimplement the needed functions. So obviously some nasty code is involved here…

Attached project contains two scheme. The ASAN one is the faulty one. Hope it will be easier to spot the crash now! : )

Additional info: the crash is only present when the address sanitiser is turned on.

Well, no, sorry... Crash is still present in 8E162. But I think I can maybe find the reason... I'll provide more info...

Issue is no longer present in Xcode 8.3 8E162. Thank you!

New crash report is attached. Tell me if I can do anything to help solving this issue.

'Crash-Xcode-beta-5.txt' was successfully uploaded.

Apple Developer Relations - 22-Mar-2017 08:25 PM

Engineering has requested the following information regarding your bug report:

Can you please provide a crash log from Xcode 8.3 beta 5 (8E161)?

Update: same issue with the latest Xcode beta - Version 8.3 beta 5 (8E161).

Stack trace is exactly the same.

Update: same issue with the latest Xcode beta - Version 8.3 beta 4 (8W143q).

Stack trace is exactly the same.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!