Swift compiler produces crashing code when optimization is enabled

Originator:serieuxchat
Number:rdar://21375217 Date Originated:14-Jun-2015
Status:Closed Resolved:
Product:Developer Tools Product Version:Version 7.0 beta (7A120f)
Classification: Reproducible:Always
 
Closed as duplicate of 21202769
--------------------------------------------------
When compiled with optimizations enabled, an attempt to assign an NSString (strong) property to an optional String from Swift code produces a crash.
Without optimizations enabled the code runs normally.

Steps to Reproduce:
1. Build and run attached test project (e.g. on the Simulator, but on a devices results will be the same).

Expected Results:
The app runs normally, and the following is printed on the Console:

Assigned property: Optional String

Actual Results:
The app crashes with an exception

Version:
Version 7.0 beta (7A120f)

Notes:


Configuration:
If you change configuration to Debug (under Scheme, Edit Scheme), then recompile, the code will run normally (in Debug configuration optimizations are not enabled).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!