-
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.crashBug: 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-7103 |
| Radar | None |
| Original Reporter | robinwit (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Xcode 9.2 (9C40b)
macOS 10.13.3 (17D102)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | |
| Labels | Bug, RunTimeCrash |
| Assignee | None |
| Priority | Medium |
md5: 5d9a0d4666ce55f5174c4a2966a76b3c
Issue Description:
The following crashes in a Playground, and while debugging an app it takes down Xcode.
import Foundation
struct Wrapper: Codable {
let objects: [MyObject]
}
struct MyObject: Codable {
let date: Date
}
let decoder = JSONDecoder()
let data = "{\"date\": \"2018-03-01T20:14:00Z\"}".data(using: .utf8)
/*
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
let data = "{\"date\": \"2018-03-01T20:14:00\"}".data(using: .utf8) // this also crashes (note the missing 'Z')
*/
try! decoder.decode(MyObject.self, from: data!) // crash hereResult:
error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
Expected:
I'd think that with the forced try, my program would just halt with the same error that I would get with do/catch, instead of crashing the compiler or Xcode.
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.crashBug: 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