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-15245] [Concurrency] Compiler crashes on attached input #57567
Comments
Still reproducible with Xcode 13.1 (downloaded as 13.1 RC) |
I would add that this kind of issue is particularly time-consuming to encounter, given Swift's propensity for long compile times: at first I have to assume this is one of these cases, and therefore attempt to reduce inference complexity among other sources of long compiles, before I am allowed to conclude this is an infinite loop in the compiler. In fact, every time I have to reproduce it I have to make sure this isn't the case; in pratice I let the build spin for one hour (60 minutes) before I can conclude I have reproduced the problem. Needless to say, this doe not help testcase reduction either. |
Reproducible on Xcode 13.2 beta, for what it’s worth. |
Reproducible on Xcode 13.2 beta 2, for what it's worth. |
Still reproducible on Xcode 13.2.1 (13C100) |
Breakthrough! I have figured out the bug occurs in a specific situation: when a function that actually captures state refers to itself in a non-escaping manner (e.g. passed as a non-escaping parameter to another function); the function may also need to be async, but that I have no way of knowing.
And why do I know the issue is not with these functions? Because I found a workaround that I only needed to apply to function iteratePossibleLeftNodesDispatch(), which matched the description before I applied the workaround. The workaround, such as it is, consists of creating a iteratePossibleLeftNodesDispatchLoop15() that refers to iteratePossibleLeftNodesDispatchLoop14(), a iteratePossibleLeftNodesDispatchLoop14() that refers to iteratePossibleLeftNodesDispatchLoop13(), and so forth, until I get to iteratePossibleLeftNodesDispatchLoop0() which goes into fatalError rather than refer to anything else. Otherwise, all with identical bodies of course. In my whole carrier, I can't remember ever having to write so seemingly pointless code in order to satisfy a compiler; and remember I used to write BASIC on the APPLE ][e. |
Attaching the latest version of the project so you can look at the workaround in context. |
While no one has gotten back to me, I no longer reproduce the issue with Xcode 14.2, so it was fixed some time between 13.2 (excluded) and that version (sorry I can't be more accurate, I haven't been very diligent on checking this issue). If I had to guess, I would say this was fixed by #41826 |
Attachment: Download
Environment
Xcode 13.0 release
Additional Detail from JIRA
md5: 5ceed28caa5ff461ebae8d4ad9c376de
Issue Description:
When attempting to use the concurrency features of Swift 5.5, I get a compiler hang. Not a runtime hang: the swift-frontend process itself, on the build machine, was still running after ~5 minutes (at which point I killed it).
Needless to say, I don't expect the compiler to get stuck like that, especially with code that is not particularly trying to trick it.
First attachment is the code that reproduces the issue; unfortunately, I have not found a way to meaningfully reduce that test case. Second attachment is the sample of the swift-frontend process.
Note: while the code is provided as an Xcode project, I can reproduce the issue with a manual invocation of the compiler, so I can only assume this is a Swift issue. I believe this issue is but a descendant of #56470.
The text was updated successfully, but these errors were encountered: