swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
66.71k stars 10.28k forks source link

[SR-16059] Use Objc Symbol on Open Class will result on LLVM crash #58320

Open wendyliga opened 2 years ago

wendyliga commented 2 years ago
Previous ID SR-16059
Radar None
Original Reporter @wendyliga
Type Bug
Environment MacOS 12.3 Xcode 13.3 Apple Silicon
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 3 | |Component/s | swift | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: a3cbb25f5715e6769be453351054910c

Issue Description:

Whenever we use an objc symbol on open class on swift 5.6, compile it under bitcode + arm64 + release config + static, we will get a LLVM crash

example

import UIKit

open class HelloWorld {
   open func hello(){ 
       UI_USER_INTERFACE_IDIOM()
   }
}

Step to Reproduce

wendyliga commented 2 years ago

I also can confirm the issue exists on non apple silicon (macOS 12.2 + Xcode 13.3)

wendyliga commented 2 years ago

the issue does not appear on Xcode 13.2.1

swift-ci commented 2 years ago

Comment by Tobias Löfstrand (JIRA)

Can also confirm that issue does not appear on Xcode 13.2.1.

Additionally, in my case, I was able to solve the problem by replacing a call to the old

UI_USER_INTERFACE_IDIOM function, with a call to UIDevice.current.userInterfaceIdiom.

wendyliga commented 2 years ago

issue hasn't been fixed on Xcode 13.3.1