Swift 5.2 Compiler Error "conflicting debug info for argument". How do debug?

Since upgrading to Swift 5.2 with Xcode 11.4, I’m having a strange compile error:

Command failed due to signal: Abort trap: 6
conflicting debug info for argument
  call void @llvm.dbg.value(metadata %objc_object* %0, metadata !7313, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !7314
!7263 = !DILocalVariable(name: "aChildCoordinator", arg: 1, scope: !7261, file: !13, line: 47, type: !403)
!7313 = !DILocalVariable(name: "aChildCoordinator", arg: 1, scope: !7257, file: !13, line: 47, type: !403)
conflicting debug info for argument
  call void @llvm.dbg.value(metadata %T10WhiteLabel19RegistryCoordinatorC* %1, metadata !7315, metadata !DIExpression()), !dbg !7316
!7265 = !DILocalVariable(name: "self", arg: 2, scope: !7261, file: !13, line: 47, type: !1703, flags: DIFlagArtificial)
!7315 = !DILocalVariable(name: "self", arg: 2, scope: !7257, file: !13, line: 47, type: !1703, flags: DIFlagArtificial)
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken module found, compilation aborted!
0  swift                    0x000000010f86a4ea PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010f869cc0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff6d5555fd _sigtramp + 29
3  libsystem_platform.dylib 0x000000011f40bacb _sigtramp + 2984994027
4  libsystem_c.dylib        0x00007fff6d42b808 abort + 120
5  swift                    0x000000010b5befc1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 1137
6  swift                    0x000000010f7e55c6 llvm::report_fatal_error(llvm::Twine const&, bool) + 278
7  swift                    0x000000010f7e54ab llvm::report_fatal_error(char const*, bool) + 43
8  swift                    0x000000010f76739c (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 204
9  swift                    0x000000010f706b73 llvm::FPPassManager::doFinalization(llvm::Module&) + 51
10 swift                    0x000000010f70dcf2 llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 82
11 swift                    0x000000010b7cacbf swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5919
12 swift                    0x000000010b7cfa50 (anonymous namespace)::LLVMCodeGenThreads::Thread::run() + 208
13 swift                    0x000000010b7cf8f9 (anonymous namespace)::LLVMCodeGenThreads::runThread(void*) + 9
14 libsystem_pthread.dylib  0x00007fff6d561109 _pthread_start + 148
15 libsystem_pthread.dylib  0x00007fff6d55cb8b thread_start + 15

I’m sort of a loss to even know where to begin to debug this. The searching I’ve done hasn’t really pointed me anywhere that makes sense with my code base (mostly C++ solutions).

I’ve located the piece of code that’s causing the error (a protocol extension), but any minor change I make doesn’t resolve it (renaming variable and arguments, etc…). This is in a pretty large codebase and I haven’t been able to reduce the error into a small piece of code. Any pointers where I can start to look into addressing this?

This is a Swift compiler crash and therefore a bug, mind filing a bugs.swift.org? Can you reproduce this in a sharable example (as minimal as possible but if you can't reduce a larger repro is still better than none).

Odd work around, but the cause of this issue is still confounding me:

So, it appears if I turn on "Code Coverage" in my testing scheme editor, I can successfully compile. But turning off code coverage leave me with this error.

@johannesweiss, sadly I have not been able to create a minimal example yet. It’s in a rather large, company codebase so I’m not sure I can pass it to you. I do have the logs for both a successful build and a failure build. The main difference seems to be -fprofile-instr-generate seems to create the proper debug info

That is odd an almost certainly an Xcode (build system?) bug. Would you be able to file a problem report in the Feedback Assistant? There you can upload large projects and they'll only be shared with Apple employees and are subject to the developer programme guidelines. If you want, you can then post the FBxxxxx number that identifies your report here.

CC @NeoNacho/@Aciid in case they've seen this before?

I have not seen this before, but from the error message "conflicting debug info for argument", I would speculate that potentially the package targets may not be compiled with code coverage but Xcode targets are?

@matt could you check in your project's build log whether that's the case?

Hi @NeoNacho, I checked the build logs and in the version that fails, nothing is compiled with code coverage.

The project structure is a bit weird. It builds a main library using Cocoapods (I’m working on porting to SPM, I swear!), and it’s that library that crashes the compiler. I’m not setting that pod to build with code coverage ever, but when I set the main app scheme to build with coverage, I see -profile-coverage-mapping -profile-generate only emitted during the build that succeed (not when it fails).

I’m trying to reduce the project as much as possible with the error still occurring. When I do that, I’ll submit it to Feedback Assistant and with my failing and succeeding build logs.

Terms of Service

Privacy Policy

Cookie Policy