-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during execution
Description
| Previous ID | SR-13439 |
| Radar | rdar://problem/67746791 |
| Original Reporter | @weissi |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Attachment: Download
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, RunTimeCrash |
| Assignee | @slavapestov |
| Priority | Medium |
md5: bd71160abded35bdcd864e042d815a3a
Issue Description:
Consider this program
import Dispatch
class Foo: CustomStringConvertible {
var x: Optional<Int>
init?(_ x: Int) {
print("Foo init \(x)")
if x == 0 {
return nil
}
self.x = x
if x == 1 {
DispatchQueue(label: "Foo").async {
print(self)
}
return nil
}
}
var description: String {
return "I exist!"
}
deinit {
print("Foo deinit \(self.x.debugDescription)")
}
}
print(Foo(1).debugDescription)
sleep(1)
it prints for me
$ swiftc test.swift && ./test
Foo init 1
nil
Segmentation fault: 11
-SEGV-
in
$ swift -version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.6.0
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during execution