Swift: "Broken function found" with no-escaping ObjC block
| Originator: | zwaldowski | ||
| Number: | rdar://20805557 | Date Originated: | 04-May-2015 04:41 PM |
| Status: | Open | Resolved: | false |
| Product: | Developer Tools | Product Version: | Xcode 6.3.1 (6D1002) |
| Classification: | Other Bug | Reproducible: | Sometimes |
Summary: swiftc aborts with "LLVM ERROR: Broken function found, compilation aborted!", with some variation. Steps to Reproduce: 1. Expose a non-escaping block from C 2. Call that with a non-escaping closure from Swift 3. Attempt to build 3. LLVM abort error Expected Results: Swift correctly generates the @objc_block thunks, builds, and runs. Actual Results: LLVM aborts, sometimes with an error "Incorrect number of arguments passed to called function" (as in the attached project) or others such as "Incorrect function signature" referencing an @thin -> @unowned_callee thunk. Version: Mac OS 10.10.4 (14E11f), Xcode 6.3.1 (6D1002), Swift 1.2 (swiftlang-602.0.49.6) Notes: Issue can be mitigated using a curried function that accepts the Swift non-escaping closure rather than an inline closure capturing the non-escaping closure. Configuration: Occurs in described scenario always. Attachments: 'CGPathApply.zip' was successfully uploaded.
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!
While the new ability to use C function pointers changes how the specific project included would work, the posted code still causes an abort trap in the compiler on Xcode 7.0 beta 2.
Referenced CGPathApply.zip: https://drive.google.com/file/d/0B3FglI-wO7Eqc2xETlk1VkdFcnc/view?usp=sharing