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-6547] Compilation fails with stack trace when using the !== identity operator #49097

Closed
swift-ci opened this issue Dec 6, 2017 · 6 comments
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

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 6, 2017

Previous ID SR-6547
Radar rdar://problem/35911150
Original Reporter chris.daley (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 16.04 AMD64

Swift 4.0, using both the most recent release (Nov 1) and trunk (Dec 5)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 80112e9917c18ab5b260de7cbe73bb21

Issue Description:

I get the following error when trying to compile this package: https://github.com/artman/Signals (I am not the author)

/swift/usr/bin/swift build -v (in directory: /Signals)
lsb_release -r
which clang
/swift/usr/bin/swiftc --driver-mode=swift -L /swift/usr/lib/swift/pm/3 -lPackageDescription -swift-version 3 -I /swift/usr/lib/swift/pm/3 -sdk / /Signals/Package.swift -fileno 6
/swift/usr/bin/swift-build-tool -f /Signals/.build/debug.yaml main -v
/swift/usr/bin/swiftc -module-name Signals -incremental -emit-dependencies -emit-module -emit-module-path /Signals/.build/x86_64-unknown-linux/debug/Signals.swiftmodule -output-file-map /Signals/.build/x86_64-unknown-linux/debug/Signals.build/output-file-map.json -parse-as-library -num-threads 8 -c /Signals/Sources/Signal.swift -I /Signals/.build/x86_64-unknown-linux/debug -swift-version 3 -target x86_64-unknown-linux -sdk / -Onone -g -enable-testing -j8 -DSWIFT_PACKAGE -module-cache-path /Signals/.build/x86_64-unknown-linux/debug/ModuleCache
swift: /home/buildnode/jenkins/workspace/oss-swift-4.0-package-linux-ubuntu-16_04/llvm/lib/IR/Instructions.cpp:2592: static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
0 swift 0x0000000003ae9918
1 swift 0x0000000003aea056
2 libpthread.so.0 0x00007f602c079390
3 libc.so.6 0x00007f602a7b1428 gsignal + 56
4 libc.so.6 0x00007f602a7b302a abort + 362
5 libc.so.6 0x00007f602a7a9bd7
6 libc.so.6 0x00007f602a7a9c82
7 swift 0x00000000039a6711
8 swift 0x00000000004d5f9b
9 swift 0x0000000000507245
10 swift 0x00000000005046f1
11 swift 0x00000000005c8c8e
12 swift 0x00000000005b4855
13 swift 0x00000000005b223d
14 swift 0x00000000004cb29e
15 swift 0x000000000058d15c
16 swift 0x000000000058d957
17 swift 0x00000000004ae518
18 swift 0x00000000004aa3eb
19 swift 0x0000000000465424
20 libc.so.6 0x00007f602a79c830 __libc_start_main + 240
21 swift 0x0000000000462ce9
Stack dump:
0. Program arguments: /swift/usr/bin/swift -frontend -c -primary-file /Signals/Sources/Signal.swift -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /Signals/.build/x86_64-unknown-linux/debug -enable-testing -g -module-cache-path /Signals/.build/x86_64-unknown-linux/debug/ModuleCache -swift-version 3 -D SWIFT_PACKAGE -emit-module-doc-path /Signals/.build/x86_64-unknown-linux/debug/Signals.build/Signalpartial.swiftdoc -Onone -parse-as-library -module-name Signals -emit-module-path /Signals/.build/x86_64-unknown-linux/debug/Signals.build/Signalpartial.swiftmodule -emit-dependencies-path /Signals/.build/x86_64-unknown-linux/debug/Signals.build/Signal.d -emit-reference-dependencies-path /Signals/.build/x86_64-unknown-linux/debug/Signals.build/Signal.swiftdeps -num-threads 8 -o /Signals/.build/x86_64-unknown-linux/debug/Signals.build/Signal.swift.o

  1. While emitting IR SIL function "@_T07Signals6SignalC18cancelSubscriptionyyXl3for_tF".
    for 'cancelSubscription(for:)' at /Signals/Sources/Signal.swift:140:12
    :0: error: unable to execute command: Aborted
    :0: error: compile command failed due to signal 6 (use -v to see invocation)
    error: terminated(1): /swift/usr/bin/swift-build-tool -f /Signals/.build/debug.yaml main -v
    Compilation failed.

The function in question:

/// Cancels all subscriptions for an observer.
///
/// - parameter observer: The observer whose subscriptions to cancel
public func cancelSubscription(for observer: AnyObject) {
signalListeners = signalListeners.filter {
if let definiteListener:AnyObject = $0.observer {
return definiteListener !== observer
}
return false
}
}

If I comment out the identity comparison and just have the function return a Bool then it compiles fine.

@belkadan
Copy link
Contributor

belkadan commented Dec 7, 2017

@swift-ci create

@aschwaighofer
Copy link
Member

Fixed by: #13416

@aschwaighofer
Copy link
Member

PR13416 was reverted because of test failures.

Reapplied with fix: #13432

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 26, 2018

chris.daley (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Sep 13, 2018

chris.daley (JIRA User), Could you verify if the problem is fixed and/or move the JIRA to "Closed"?
Thanks!
Anna

@swift-ci
Copy link
Collaborator Author

Comment by Chris Daley (JIRA)

Works for me

@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
Projects
None yet
Development

No branches or pull requests

4 participants