Swift Compiler (Release Configuration optimizer) crash for complex formula
| Originator: | marcvanolmen | ||
| Number: | rdar://19730951 | Date Originated: | 2/5/2105 |
| Status: | Resolved | Resolved: | |
| Product: | XCode | Product Version: | 6.1.1 |
| Classification: | Crash | Reproducible: | Always |
Made a project to demonstrate the bug:
https://github.com/marcvanolmen/SwiftReleaseCompilerCrash
Summary:
The swift compiler crashes in optimize mode (release mode) on a complex formula
Steps to Reproduce:
compiling this code with -O causes a crash and app doesn't build.
import UIKit
class ViewController: UIViewController {
var numPositions:Int = 2
var pixelsPerDot:CGFloat = 3
var selectedDotIndex:Int = 3
func updatePositionWithPointX(x: CGFloat) {
let newDotIndex = min(self.numPositions-1, max(0, Int( (x - (self.pixelsPerDot/2)) / self.pixelsPerDot)))
if newDotIndex != self.selectedDotIndex {
self.selectedDotIndex = newDotIndex
}
}
}
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!
I heard back from Apple
I heard back from Apple and they informed me it was fixed Xcode 6.3 beta and indeed this one is fixed in Xcode 6.3 beta