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-10560] Swift crash on Linux when casting Any? to Any when calling a throwing function from a subscript #52960

Open
swift-ci opened this issue Apr 26, 2019 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software Linux Platform: Linux

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10560
Radar None
Original Reporter brianstrobach (JIRA User)
Type Bug

Attachment: Download

Environment

Crashes when running Swift 5 on Linux via Docker.

Compiles without warning on Xcode 10.2.

Runs fine and passes tests on MacOS 10.14.3.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, Linux
Assignee None
Priority Medium

md5: 64b68a277d9e792baeba13f82f4c9145

Issue Description:

Although this is likely a coding mistake on my part, this code compiles and runs fine on macOS, but crashes when compiling on Linux, so I thought it might still be worth reporting.

To reproduce:

  1. Clone the repo here

  2. Run ./run_tests.sh which will use docker to test on Linux

The code that causes the error at runtime is line 73 in KVC.swift.

subscript (key: String) -> Any {
    get {
        return (try? get(key: key)) as Any
    }
    set {
        _ = try? set(value: newValue, key: key)
    }
}

Tests pass when applying this fix which can be found in the master branch of the same repo:

subscript (key: String) -> Any {
        get {
            let value = try? get(key: key)
            return value as Any
        }
        set {
            _ = try? set(value: newValue as Any, key: key)
        }
}
@belkadan
Copy link
Contributor

It's actually crashing compiling the tests, from your stack trace. @slavapestov, @jckarter, does this look familiar?

@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
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software Linux Platform: Linux
Projects
None yet
Development

No branches or pull requests

3 participants