You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
johnno1962 opened this issue
Jul 11, 2017
· 4 comments
Labels
AndroidPlatform: AndroidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfruntimeThe Swift Runtime
SR-5414 ImageInspectionELF.cpp:getSectionInfo crashes on Android
Issue Description:
I’ve been chipping away at getting Swift to work on Android and found that there are problems with the implementation of do/try/catch when swift is run an Android device.
The following example program:
import Foundation
print("Hello, Android")
do {
print("HERE1")
try { throw NSError(domain:"Oh", code:-1) }()
}
catch let err as Error {
print("HERE2")
}
print("DONE")
This is causing crashes in corefoundation where errors should have been trapped and code goes down the wrong path as a result. This is from a version of Swift from master about a month ago. I’ll be building from a more up to date version soon and will close this report if this is resolved.
The text was updated successfully, but these errors were encountered:
I’ve updated https://bugs.swift.org/browse/SR-5414 which is thhe only other known problem with the Swift runtime which I though might be related to this problem. This seems not to be the case. It just seems thrown exceptions are not caught at all on the Android port of Swift.
I’ve raised a PR on swift-llvm apple/swift-llvm#55 to resolve this. The problem was r8 was being saved and restored on entry/return from functions that throw. This was overwriting the value for r8 which was intended to be the object being thrown resulting in calling code failing to catch the exception.
AndroidPlatform: AndroidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfruntimeThe Swift Runtime
Environment
http://johnholdsworth.com/android_toolchain.tgz
Additional Detail from JIRA
md5: 811dce9ad8c11216c611c20e8ee4b825
relates to:
Issue Description:
I’ve been chipping away at getting Swift to work on Android and found that there are problems with the implementation of do/try/catch when swift is run an Android device.
The following example program:
Produces this output on Linux/macOS:
Whereas on Android following the instructions from https://github.com/apple/swift/blob/master/docs/Android.md
produces the following output:
This is causing crashes in corefoundation where errors should have been trapped and code goes down the wrong path as a result. This is from a version of Swift from master about a month ago. I’ll be building from a more up to date version soon and will close this report if this is resolved.
The text was updated successfully, but these errors were encountered: