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-2773] function abnormally releasing instance. #45377
Comments
Comment by erica sadun (JIRA) mikeash: erica: definite codegen bug, with a totally cut down example I see one retain and two releases |
The retains and releases look correct to me; I think Mike missed Swift's +1 convention. It looks like we drop the |
Oops, no, that's not exactly it. But the explicit signature does fix the problem, which is suspicious. |
Ah, it's the reabstraction thunk for the closure-to-closure conversion because of the dropped
There should be a retain of |
(i.e. Mike was right, and I should expect that by now) |
Slava's on vacation at the moment. @jckarter? |
I think we fixed this one on master. Not sure if it made it to 3.0.1. |
The bug still exists in Swift 3.0.2 (Xcode 8.2).
|
Indeed, I'm seeing it on master again as well. Not sure what I checked before. |
@swift-ci create |
Yay! `test.swift` no longer crashes in Swift 3.1 (Xcode 8.3 beta 2). Looks like the bug is finally fixed. |
Great! |
This piece of code crashes again in Swift 4 (Xcode 9 beta 6) ~/Desktop
> swift --version
Apple Swift version 4.0 (swiftlang-900.0.63.10 clang-900.0.36)
Target: x86_64-apple-macosx10.9
~/Desktop
> cat test.swift
import Foundation
public func with<T: AnyObject>(_ item: T, update: (inout T) throws -> Void) rethrows -> T {
var this = item
try update(&this)
return this
}
let p = Process()
let task3 = with(p) {
$0.launchPath = "/usr/bin/mdfind"
$0.arguments = ["kMDItemDisplayName == *.playground"]
$0.standardOutput = pipe
}
let task4 = with(Process()) {
$0.launchPath = "/usr/bin/mdfind"
$0.arguments = ["kMDItemDisplayName == *.playground"]
$0.standardOutput = pipe
}
print(task3)
print(task4)
~/Desktop
> swiftc test.swift
~/Desktop
> ./test
<NSConcreteTask: 0x7fef3740b330>
fish: './test' terminated by signal SIGSEGV (Address boundary error) |
I'll clone a new bug for it, then. |
Additional Detail from JIRA
md5: 67a6e66d0f886f367c56762144624056
cloned to:
is duplicated by:
Issue Description:
See: https://gist.github.com/erica/1bb492d616370c5e8ae3383b140c41b4
If the silly `ptr` workaround is commented out, the second test (task4) fails. I've tested in Xcode and at the command line.
The text was updated successfully, but these errors were encountered: