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-10264] EXC_BAD_ACCESS when assigning to a field in a testable class with a key-path #52664
Comments
@jckarter, I think you had one of these already, right? |
The other cases I'm aware of involved protocol extensions, but this only involves a class. It may be different. |
Comment by Felix Scheinost (JIRA) I also have this exact same crash but instead of Foo being a class it is a struct and the property has an empty didSet. It doesn't crash if I remove the didSet. struct Foo {
var test: Int {
didSet {
}
}
} final class CrashTest: XCTestCase {
func testCrash() {
var b1 = Foo(test: 0)
b1.test = 1
b1[keyPath: \.test] = 2
}
} I'm on Xcode 10.2.1 (10E1001) |
I wasn't able to reproduce this in the master branch. Would you be able to try a recent snapshot from https://swift.org/download/ and see whether you still have the problem? |
Comment by Juri Pakaste (JIRA) I tested this with Xcode 10.2.1 (10E1001), using the built-in toolchain, Swift 5.1 Snapshot 2019-05-09 (a) and Swift Development Snapshot 2019-05-20 (a), and still got crashes using all the toolchains. The backtraces using the snapshot toolchains were slightly different from the release one, but maybe that's just an artifact of having debug info included or something? Here's the most relevant frames from the backtrace with the Swift Development Snapshot 2019-05-20 (a):
|
Thanks for following up! I gave the master snapshot from 05-20 a try in Xcode, and I couldn't reproduce. (I verified that it does repro in stock Xcode 10.2 and with the 5.1 05-09 snapshot.) So either this was fixed recently, or the fix is not in the 5.1 branch. Let me try building a more recent 5.1 compiler to see whether I can repro. |
A compiler I just built off of the tip of the 5.1 branch also didn't crash. |
Environment
Xcode 10.2 (10E125)
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
macOS 10.14.4 (18E226)
iOS simulator with iOS 12.2 (16E226)
Additional Detail from JIRA
md5: fcc8044a8caab7fcf236a31574835eff
is duplicated by:
Issue Description:
I have the following in an iOS framework target called KeyPathCrash:
And the following file in the test target:
The test crashes with "Thread 1: EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff8)". If I have the key-path assignment inside the framework target, it works fine.
This is a new problem with Xcode 10.2/Swift 5. It worked with Xcode 10.1/Swift 4.2.
The text was updated successfully, but these errors were encountered: