❯ xcodebuild -version Xcode 11.2 Build version 11B52
❯ swift --version Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9) Target: x86_64-apple-darwin19.0.0
Issue occurs on iOS 13.2 simulators and devices. Issue does not occur on macOS 10.15. Have not tested other situations.
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug, Generics, Miscompile, RunTimeCrash
Assignee
None
Priority
Medium
md5: 41c97f70c67c490b9198ff1f08d9c0b4
duplicates:
SR-11564 Swift 5.1.1 Regression: Bad access on generic types exported symbols – device only.
Issue Description:
I've hit an issue where a custom subscript I defined on a type in one of my Swift packages is causing a crash when running on iOS, but not on macOS (either with Catalyst or not).
I've attached a minimal reproduction package, which only shows the issue when running the tests in Xcode on an iOS simulator or device. In my real use case, this issue reproduces in both test cases and when using the package from an app.
I've reduced it down to a class shaped something like this:
I just hit another case of something like this with the Entwine Swift package. In this case, there's no subscript involved, but the class is non-final, generic, and has private variables. I'm seeing iOS crash trying to access a field from a totally different class, while macOS works just fine.
Attachment: Download
Environment
❯ xcodebuild -version
Xcode 11.2
Build version 11B52
❯ swift --version
Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)
Target: x86_64-apple-darwin19.0.0
Issue occurs on iOS 13.2 simulators and devices. Issue does not occur on macOS 10.15. Have not tested other situations.
Additional Detail from JIRA
md5: 41c97f70c67c490b9198ff1f08d9c0b4
duplicates:
Issue Description:
I've hit an issue where a custom subscript I defined on a type in one of my Swift packages is causing a crash when running on iOS, but not on macOS (either with Catalyst or not).
I've attached a minimal reproduction package, which only shows the issue when running the tests in Xcode on an iOS simulator or device. In my real use case, this issue reproduces in both test cases and when using the package from an app.
I've reduced it down to a class shaped something like this:
The crash is triggered by creating a new instance and setting the subscript with any key/value.
The following details I've found to be important (removing any of them makes the crash go away):
The class must be generic
The class must have a private variable
The class must be non-final
The class must live in a module of a Swift package (the same use case with a class in an iOS framework linked by an app does not reproduce the issue)
I've seen the crash on a stack frame like this:
#0 0x00000001060a1099 in method descriptor for UserActions.Context.subscript.modify
In the attached test case, it's much weirder, as it's referencing a different type than the one the subscript is being called on:
#0 0x0000000102a3aba8 in direct field offset for NotCrashy.data ()
The text was updated successfully, but these errors were encountered: