-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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-13797] Segfault in swift::PartialApplyInst::create #56194
Comments
@swift-ci create |
In the 10/29 development snapshot, we trip an assertion for running out of closure discriminators:
The invalid discriminator is 0xFFFF, so discriminators currently max out at 16 bits. By my count, we are currently using no more than 11 bits of the Bits field of AbstractClosureExpr and its subclasses, so we could expand this to 21 bits without any other changes if we wanted to, or move the discriminator into a separate 32- or 64-bit field. hughbe (JIRA User), as a workaround, try to avoid having more than 2^16-1 closures or autoclosures in a single function. |
After some discussion with Becca, here's a breakdown of what is going on here: 1. We have a total of 64-bits available for storing information, regardless of whether the host is 32-bit or 64-bit. This is indicated by the One unfortunate consequence of this is that we can't align the Discriminator to a 4-byte boundary without changing way too much code. I think that's okay. We can leave the padding Understanding what's going is somewhat tricky, but I suspect the fix will likely take < 50 LoC worth of changes. I think someone can potentially tackle this as a somewhat ambitious StarterBug. Please feel free to ask questions here; the bit-field macro soup can be a bit of a headache to understand. Work style notes: It may be helpful to come up with a minimal test case before making the change and make sure it hits the assert (maybe make a middle commit here marking the test as XFAIL); and then fix the code and make sure the test passes. Iterating on this change will take time as you'll be modifying widely-used headers a fair bit, so a lot of code will need to be recompiled whenever you make a change. |
Environment
macOS Catalina 10.15.7 (19H2)
Xcode Version 12.0.1 (12A7300)
Additional Detail from JIRA
md5: 2ec8b445c93ac5fadb92557f27dbf8d7
Issue Description:
Steps to reproduce:
Clone this branch: https://github.com/hughbe/PstReader/tree/Segfault-example
Open Package.swift in Xcode
Build the tests
Expected:
Although the file is obviously disgustingly long, it should not crash the compiler
Actual:**
Segmentation fault: 11
The text was updated successfully, but these errors were encountered: