New issue
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
[SR-1720] Miscompile / misoptimize / Foundation bug with JSON decoding #4141
Comments
/cc @phausler |
Starting this off on Foundation, I think the compiler |
let bytes = [UInt8](string.utf8) This may result in non null terminated data from the string. You probably want string.data(using: .utf8) |
I wouldn't expect the data to need to be null terminated... is the Linux Foundation assuming it is? |
I think the objc one is tolerant of it, the linux version I think expects it. func parseTypedNumber(_ address: UnsafePointer<UInt8>) -> (Any, IndexDistance)? This calls out to strtol with a non-nil terminated buffer. |
This is fixed, right? |
At least one bug around this failure has been fixed, and I added a unit test to verify (which went from failing 100% to passing 100%) |
Pushed e6f84e9 -> swift-corelibs-foundation/master |
Additional Detail from JIRA
md5: 881ab4f14492257a2a5b9d5987ff0c18
Issue Description:
The following small test case, extracted from SwiftPM, fails non-deterministically when built with optimizations enabled. I haven't yet isolated it past this point, so this could be a memory smasher in XCTest, a bug in Foundation, or a misoptimization.
I have only reproduced this failure on Ubuntu 14.04.
This is causing non-deterministic CI test failures.
This is the test script I am using to reproduce the problems:
This script will build and run (once adjusted for your build directory) and usually fails in the first few iterations with something like:
The text was updated successfully, but these errors were encountered: