Skip to content
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-10117] EXC_BAD_INSTRUCTION in playground #52519

Closed
Agarunov opened this issue Mar 15, 2019 · 4 comments
Closed

[SR-10117] EXC_BAD_INSTRUCTION in playground #52519

Agarunov opened this issue Mar 15, 2019 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 5.0

Comments

@Agarunov
Copy link

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.

@belkadan
Copy link
Contributor

Crashes on master too (outside of a playground):

Assertion failed: (isTypeMetadata()), function getDescription, file /Volumes/Data/swift-public/swift/include/swift/ABI/Metadata.h, line 1069.
zsh: abort      ./main

@jckarter, @mikeash, does this look familiar? I don't see anything obviously wrong with Anton's code.

@mikeash
Copy link
Contributor

mikeash commented Mar 19, 2019

That's a new one for me. I don't get that isTypeMetadata failure (are you suffering from stale-CMake-itis?) but I do get the misaligned load error from the original report. It only happens for me when using the interpreter, though, not when compiling and running. The error happens in _resolveRelativeIndirectableAddress, which in the example I have in the debugger was called with a base of 0x0000000106cfd01c. Not sure where that bogus value is coming from.

@Agarunov
Copy link
Author

Looks like this bug fixed in Xcode 11.3

@Agarunov
Copy link
Author

Also works in Xcode 11.4.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 5.0
Projects
None yet
Development

No branches or pull requests

4 participants