Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8201] Crash in DiagnoseStaticExclusivity (llvm_unreachable) #50733

Closed
swift-ci opened this issue Jul 7, 2018 · 2 comments
Closed

[SR-8201] Crash in DiagnoseStaticExclusivity (llvm_unreachable) #50733

swift-ci opened this issue Jul 7, 2018 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 4.2

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jul 7, 2018

Previous ID SR-8201
Radar rdar://problem/41976355
Original Reporter obbut (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 16.04, Swift 4.2 snapshot 2018-07-05

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.2Regression, CompilerCrash
Assignee @atrick
Priority Medium

md5: 58a83f9b3392f15bc801d4797d414097

Issue Description:

This happens on any Swift 4.2 snapshot from the last weeks, on Ubuntu 16.04.

To reproduce:

Clone https://github.com/OpenKitten/BSON at 383f18b0d18e50f6c2cb8a22ef1c116b474b2e90. Run swift build.

In short, it reaches llvm_unreachable here while running DiagnoseStaticExclusivity on this. It does not happen on macOS.

The log:

Compile Swift Module 'BSON' (30 sources)
/home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/PrimitiveConvertible.swift:16:40: warning: 'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value
        return Document(elements: self.flatMap { $0.makePrimitive() }.enumerated().map { ("\($0)", $1) }, isArray: true)
                                       ^
/home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/PrimitiveConvertible.swift:16:40: note: use 'compactMap(_:)' instead
        return Document(elements: self.flatMap { $0.makePrimitive() }.enumerated().map { ("\($0)", $1) }, isArray: true)
                                       ^~~~~~~
                                       compactMap
Argument must be @noescape function type:   %617 = partial_apply [callee_guaranteed] %612(%1, %3, %613, %614, %615) : $@convention(thin) (Optional<UnsafePointer<UInt8>>, Int, Optional<DocumentCache.Dimensions>, @inout_aliasable Document, @guaranteed { var Optional<TypeIdentifier> }, @guaranteed { var Bool }, @guaranteed String) -> () // user: %619
A partial_apply with @inout_aliasable may only be used as a @noescape function type argument.
UNREACHABLE executed at /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-16_04/swift/lib/SILOptimizer/Mandatory/DiagnoseStaticExclusivity.cpp:861!
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x4106dd4]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x4104c62]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x4106f82]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f0d3d177390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f0d3b8b6428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f0d3b8b802a]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x409fd6d]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0xdc8e45]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0xd51e03]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0xd52901]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0xd53834]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x5c0d88]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0xd5a865]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x4ddd4f]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x4d9b50]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x48a2e8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f0d3b8a1830]
/home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift[0x487fa9]
Stack dump:
0.  Program arguments: /home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift -frontend -c -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Codable/Codable.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Codable/Decoding/BSONDecoder.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Codable/Decoding/BSONDecoderSettings.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Codable/Encoding/BSONEncoder.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Codable/Encoding/BSONEncoderStrategies.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Debugging/CustomDebugStringConvertible.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Array.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Cache.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Dictionary.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+DynamicMemberLookup.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Equatable.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Helpers.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Mutations.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Sequence.swift -primary-file /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Serialization.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Subscripts.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Validation.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Helpers/BSONBuffer+Helpers.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Helpers/BSONBuffer.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Helpers/PointerHelpers.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Binary.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Decimal128.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Null.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/ObjectId.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Optional.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/PrimitiveConvertible.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Primitives.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/Timestamp.swift /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Types/TypeIdentifier.swift -supplementary-output-file-map /tmp/org.swift.swiftpm..../supplementaryOutputs-2103fc -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug -enable-testing -g -module-cache-path /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/ModuleCache -swift-version 4.2 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -parse-as-library -module-name BSON -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Codable/Codable.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Codable/Decoding/BSONDecoder.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Codable/Decoding/BSONDecoderSettings.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Codable/Encoding/BSONEncoder.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Codable/Encoding/BSONEncoderStrategies.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Debugging/CustomDebugStringConvertible.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Array.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Cache.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Dictionary.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+DynamicMemberLookup.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Equatable.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Helpers.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Mutations.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Sequence.swift.o -o /home/.../Workingcopies/.../Packages/BSON/.build/x86_64-unknown-linux/debug/BSON.build/Document/Document+Serialization.swift.o 
1.  While running pass #&#8203;5 SILFunctionTransform "DiagnoseStaticExclusivity" on SILFunction "@$S4BSON8DocumentV5write_13forDimensions3keyyAA9Primitive_p_AA0B5CacheC0E0VSgSStF".
 for 'write(_:forDimensions:key:)' at /home/.../Workingcopies/.../Packages/BSON/Sources/BSON/Document/Document+Mutations.swift:4:14
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /home/.../swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a-ubuntu16.04/usr/bin/swift-build-tool -f /home/.../Workingcopies/.../Packages/BSON/.build/debug.yaml main output:
    
@belkadan
Copy link
Contributor

belkadan commented Jul 9, 2018

Thanks for providing not just the source but the revision too!

@swift-ci create

@atrick
Copy link
Member

atrick commented Jul 25, 2018

The crash was fixed on 4.2:

<rdar://problem/41976355> [SR-8201]: Swift 4.2 Crash in DiagnoseStaticExclusivity (llvm_unreachable)

I filed a separate problem to strengthen the diagnostics, which will be fixed shortly on master:

<rdar://problem/42560459> [Exclusivity] Failure to statically diagnose a conflict when passing conditional noescape closures.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 4.2
Projects
None yet
Development

No branches or pull requests

4 participants