SIMD crashing debug build

Hi,


There has been a change in SIMD handling in swift since Xcode 8 beta 1, which is resulting in the debug build crashing under certain circumstances. The repro for this is extremely simple.


The following code snippet with build in release mode but fail in debug mode:



import UIKit

import simd

class ViewController: UIViewController {


let f2 = float2(0, 0)

override func viewDidLoad() {

super.viewDidLoad()


let crash_debug = int2(Int32(f2.x), Int32(f2.y))


print("*** crash_debug = \(crash_debug)")

}

}


In particular the issue is related to "crash_debug" being declared as a constant, which is correct however. I can work around this issue by changing the declaration of "crash_debug" from using "let" to using "var". This allows the debug build to succeed, however this results in a warning stating that "crash_debug" is not changed anywhere and should be declated with "let".


I've already created a bug report for this over at "bugreport.apple.com" but it has not gotten any attention - 27718172


Regards,

Joe

Accepted Reply

FYI - The repro above now compiles correctly in debug mode in Xcode 8 GM seed.


Thanks,

Joe

Replies

I've update bug report 27718172 with the repro above, previously the repro was a little longer.


Has anyone been able to verify the bug internally at Apple?


Regards,

Joe

Yes, I was able to reproduce it. It turns out to be a duplicate of a problem that we recently fixed for Swift 3.

OK great.


Thanks for the update,


Regards,

Joe

FYI - The repro above now compiles correctly in debug mode in Xcode 8 GM seed.


Thanks,

Joe