Skip to content

[SR-10117] EXC_BAD_INSTRUCTION in playground #52519

@Agarunov

Description

@Agarunov
Previous ID SR-10117
Radar rdar://problem/49003179
Original Reporter @Agarunov
Type Bug
Status Resolved
Resolution Done
Environment

Swift 5.0, Xcode 10.2 beta 4 (10P107d)

Additional Detail from JIRA
Votes 3
Component/s
Labels Bug, 5.0Regression, RunTimeCrash
Assignee None
Priority Medium

md5: c97503b1b92f501474dcd29ed0878712

is duplicated by:

  • SR-10446 Swift 5 regression: playground/REPL crash around key paths

relates to:

  • SR-10185 Runtime crash using KeyPath: load from misaligned raw pointer
  • SR-10590 Compiler crash with key paths and generics

Issue Description:

This code crashes Playground execution in Xcode 10.2 beta 4 (10P107d)

But works fine in Xcode 10.1.

import Foundation

let strs: [[String]] = [["adfasdf", "adfasf"], ["sdghdgfh", "hjfhgjfg"], ["dfghfgd", "5t345", "sdfsdfs"]]

extension Collection {
    func map<R>(_ keyPath: KeyPath<Element, R>) -> [R] {
        return map { $0[keyPath: keyPath] }
    }
}

let s = strs.map(\.first)
// 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.
// In Console: Fatal error: load from misaligned raw pointer


print(s)

Maybe its only Xcode/Playgroud issue, not compiler issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareregressionrun-time crashBug → crash: Swift code crashed during executionswift 5.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions