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-5874] Runtime crash when using optional extension for closure #48444

Open
swift-ci opened this issue Sep 12, 2017 · 6 comments
Open

[SR-5874] Runtime crash when using optional extension for closure #48444

swift-ci opened this issue Sep 12, 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 SILGen Area → compiler: The SIL generation stage

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5874
Radar None
Original Reporter mikekasp (JIRA User)
Type Bug
Environment

Xcode 8.3.3 - Xcode 9

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

md5: 60e185a14e55cd47c86630bf1fa588d5

Issue Description:

The following code crashes always:

extension Optional { // where Wrapped == ()->() { // With this, no crash
    var method: Bool { return false }
}

class bar {
    var t: Bool = false {
        didSet {
            self.stuff(closure: { print("\(self)") })
        }
    }

     func stuff(closure: (() -> ())? = nil) {
        closure.method
    }
}

bar().t = false
@belkadan
Copy link
Contributor

On near-master:

Assertion failed: (isPlusOne(SGF) && "Can not forward borrowed RValues"), function forwardInto, file /Volumes/Data/swift-public/swift/lib/SILGen/RValue.cpp, line 533.

1.  While emitting SIL for 'stuff(closure:)' at <stdin>:12:6

@jckarter? Or @gottesmm, for ownership?

@gottesmm
Copy link
Member

This would be on me, but before we get to that mikekasp (JIRA User) are you using the actual toolchain in Xcode? Or are you using a custom toolchain?

@gottesmm
Copy link
Member

The reason why I am asking is that I thought that assertion was not enabled in the actual Xcode toolchain.

@swift-ci
Copy link
Collaborator Author

Comment by Mike Kasperlik (JIRA)

Using the standard toolchain. Nothing custom.

@gottesmm
Copy link
Member

Oh. I misunderstood. The assert is from a near master build by Jordan. Sorry for the noise!

@gottesmm
Copy link
Member

@swift-ci sync

@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
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 SILGen Area → compiler: The SIL generation stage
Projects
None yet
Development

No branches or pull requests

4 participants