[SR-4687] Object corruption when generics are used with UIView on iOS 9 simulators #47264
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
run-time crash
Bug → crash: Swift code crashed during execution
Attachment: Download
Environment
Xcode 8.3.2, iOS 9.2/9.3 simulator
Additional Detail from JIRA
md5: e174098a42cc35c0971bb5029f815063
Issue Description:
I'm seeing a really weird issue where objects get corrupted when using generics on the iOS 9.2/9.3 simulators. I've attached an Xcode project showing the issue. Also I've reproduced the problematic part of the code below:
It looks like the initialisation of 'b' in MainObject is causing 'a' to become corrupted. The crash is:
It appears that when trying to read the label property we actually end up reading the x property instead. I suspect this is something to do with the difference in the sizing of the specialisation (Int vs Double); if I change both a and b to be of type
BaseView<Double>
, then problem goes away.Other observations:
This only seems to occur in the iOS 9.2/9.3 simulator
It doesn't crash on an iOS 9.2 device (although this may be chance)
iOS 10 simulator is fine
I'm not sure if this is a platform issue or a swift one
Problem was seen in both Xcode 8.2.1 and Xcode 8.3.2
The text was updated successfully, but these errors were encountered: