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-102] Optimizer introduces EXC_BAD_ACCESS; fills String with garbage #42724
Comments
Still fresh in new config Xcode Version 7.2 (7C68) |
Michael, who'd be a good candidate to look into this? |
In general you should send these to Nadav. But it is fine to park them on me in the short term. |
To the reporter, we are going to be using the other bug tracker field to relate to our internal bug tracking system (I am not sure if in JIRA we can do multiple, but we should look into this). So I need to relate this to our internal radar number. Here is the issue you posted: https://code.sealedabstract.com/drewcrawford/CaveJohnson2/issues/10. |
I am looking at this now. |
I have reproduced a crash with optimization given this compiler: Apple Swift version 2.1.1 (swiftlang-700.1.101.13 clang-700.1.81) I am trying with ToT. |
This is my single file test case. import Foundation public final class ServerConfig { } public final class XCSAPI { } print("Hello, World!") try! XCSAPI.integrateNow("test", serverConfig: ServerConfig()) |
I am reproducing with ToT btw. I am bisecting now. |
It looks like the pass that exposes the issue is ARCSequenceOpts. It may just be exposing other bad behavior though. |
Ok I figured out the problem. It is an issue with ARC but it is relatively benign in the sense that I already know the solution and it shouldn't be too bad. The issue is how we are handling the use of a try_apply insertion point. I thought due to a quirk in the way we compute insertion points this would not come up, but I was incorrect. So now I need to make the appropriate change to handle this correctly. |
Turns out a similar problem can occur with loops if our pre-header insertion fails. I fixed this in: To git@github.com:apple/swift.git |
I have a fix, I am just writing more tests/checking for any perf issues. |
I have everything waiting to go. I am just waiting for Dmitri to fix the perf test suite so I can measure before/after performance just in case. |
To git@github.com:apple/swift.git |
Attachment: Download
Environment
Xcode Version 7.1.1 (7B1005)
OSX 10.11.1 (15B42)
The Swift that ships with Xcode
Additional Detail from JIRA
md5: 9cad99f685ab340bc14e9b92518c1eff
Issue Description:
In the attached project, an optimizer pass seems to (incorrectly) optimize out a string. The result is that the string is both live and holds garbage data.
1. Open attached project
2. Set configuration to Release
3. Run
Expected results:
Hello, World! path /api/bots/test/integrations Data <74657374>
Functions as expected in Debug configuration.
Actual results:
Hello, World! path /api/bots/test/integrati\250\262,\262,, Segmentation Fault: 11
I have minimized this example as well as I can, and I think it's an optimizer bug (setting component to Compiler), but in practice reproducing it seems to require calling
dataUsingEncoding
for reasons I don't understand.The text was updated successfully, but these errors were encountered: