Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachment: Download
md5: c5cc09c9166c89fdf7c203ffdac97417
Issue Description:
In swift-DEVELOPMENT-SNAPSHOT-2018-06-22-a-osx, this code:
var info = task_basic_info() var infoSize = mach_msg_type_number_t(MemoryLayout<task_basic_info>.size / MemoryLayout<natural_t>.size) withUnsafeMutablePointer(to: &info) { infoPointer in infoPointer.withMemoryRebound(to: integer_t.self, capacity: MemoryLayout<task_basic_info>.size / MemoryLayout<integer_t>.size) { let result = task_info(mach_task_self_, task_flavor_t(TASK_BASIC_INFO), $0, &infoSize) if result != KERN_SUCCESS { print("Failed to get task info: \(result)") } } }
causes this crash on devices(mine is iPhone 6s) but not on simulators:
#​0 0x00000001046f84e4 in thunk for @callee_guaranteed (@unowned UnsafeMutablePointer<Int32>) -> (@error @owned Error) () #​1 0x00000001046f8800 in partial apply for thunk for @callee_guaranteed (@unowned UnsafeMutablePointer<Int32>) -> (@error @owned Error) () #​2 0x0000000104c245f4 in UnsafePointer.withMemoryRebound<A, B>(to:capacity:_:) () #​3 0x0000000104e307f8 in UnsafeMutablePointer.withMemoryRebound<A, B>(to:capacity:_:) () #​4 0x00000001046f81d0 in closure #​1 in UIDevice.getTaskInfo() at /Users/an0/Desktop/WithMemoryReboundBug/WithMemoryReboundBug/UIDevice+Memory.swift:18 #​5 0x00000001046f8254 in partial apply for closure #​1 in UIDevice.getTaskInfo() () #​6 0x00000001046f8554 in thunk for @callee_guaranteed (@unowned UnsafeMutablePointer<task_basic_info>) -> (@error @owned Error) () #​7 0x00000001046f85e4 in partial apply for thunk for @callee_guaranteed (@unowned UnsafeMutablePointer<task_basic_info>) -> (@error @owned Error) () #​8 0x0000000104cc825c in withUnsafePointer<A, B>(to:_:) () #​9 0x0000000104e32438 in withUnsafeMutablePointer<A, B>(to:_:) ()
The text was updated successfully, but these errors were encountered:
aschwaighofer@apple.com (JIRA User), is this the thing you just fixed with withoutActuallyEscaping?
withoutActuallyEscaping
Sorry, something went wrong.
Would Arnold's fix impact code that doesn't use withoutActuallyEscaping?
@swift-ci create
IIUC it was a general problem with thunking of nested closures, but I wasn't following it too closely. You could be right.
I wasn't able to reproduce the crash with the attached project using the default toolchain in Xcode 10, maybe it's a recent regression.
Hm, I wasn't able to reproduce with the 4.2 snapshot toolchain from 2018-06-23 either. @an0 did you have any other unusual build settings on the attached project when it crashes for you?
Reproduces on an arm64 device with a current 4.2 snapshot for me.
This will be fixed as soon as the toolchains pick up apple/swift-llvm@9283149
aschwaighofer
No branches or pull requests
Attachment: Download
Additional Detail from JIRA
md5: c5cc09c9166c89fdf7c203ffdac97417
Issue Description:
In swift-DEVELOPMENT-SNAPSHOT-2018-06-22-a-osx, this code:
causes this crash on devices(mine is iPhone 6s) but not on simulators:
The text was updated successfully, but these errors were encountered: