-
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-11336 |
| Radar | None |
| Original Reporter | pschuh (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, Crash |
| Assignee | None |
| Priority | Medium |
md5: 6c4c6e52724c440ca710405a852fb670
blocks:
- TF-799 Re-enable tests involving -enable-ownership-stripping-after-serialization
Issue Description:
protocol SomeProtocol {}
func SR_11336(_ array: Array<Int>) {
let keyPaths: [PartialKeyPath<Array>] = array.indices.map { \Array<Int>[$0] }
for kp in keyPaths {
_ = array[keyPath: kp] is SomeProtocol
}
}
let array: [Int] = [1000, 1]
// Crashes only if `array` contains 2 or more elements.
SR_11336(array)The cause is enabling -Xfrontend -enable-ownership-stripping-after-serialization for swiftCore.
This was done in 4ecab47 (for swiftCore), then later in 447f008 (for swiftCore and overlays).
Reproduce:
$ swift sr-11336.swift
[1] 96610 illegal hardware instruction $SWIFT_BIN/swift sr-11336-2.swiftWeirdly, swiftc sr-11336.swift && ./sr-11336 doesn't crash.
$ swiftc sr-11336.swift && ./sr-11336
# Succeeds, no crash.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