-
Notifications
You must be signed in to change notification settings - Fork 833
12322: Fix deep recursive expression processing #12420
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
Conversation
|
OK, this is ready, subject to being green. There is the automated test matrix in the PR (see tests.fs) and I've been through the same manual steps up above |
|
I took the opportunity to cleanup the test configuration matrix used in test\fsharp\tests.fs |
|
Curious that the latest preview (17.1.0 Preview 2) doesn't seem to contain this fix. Is that expected? |
|
@kentcb you'll want to check what version of the SDK is bundled with 17.1.0 Preview 2. I tested this manually with the 6.0.2xx nightly previews (which you can download from the table at the dotnet/installer repo, and the sample code in the linked issue #12322 compiled successfully for me. I don't believe this fix made it into 'servicing' for the 6.0.1xx series of SDKs, but others may have more insight there. |
|
Sorry to ping you @baronfel, but do you know who I should be bugging about this? I believe this to be a fundamental flaw that needs to be patched - I am blocked from using my project on VS22 as a result. |
|
It should be in 6.0.200, an probably next dev17 preview. @brettfo do you know if it made it there? |
|
Hmm, I can successfully build my repro project from the CLI with |
|
@kentcb By default VS uses the .NET Framework compiler. There's a way to adjust your project to use the .NET SDK compiler, (@KevinRansom can give the details or search this repo) |
|
Is this problem solved? I get MSB6006 "fscAnyCpu.exe" exited with code -1073741571. with no reference to which file the compilation fails. I am using VS2022 17.1.1 The workaround is to continue to use VS2019. Also, my command line compilations continue to work. It is a big F# project, used to be Ocaml when created 20 years ago. Some files are very big switch statements or big functions with internal functions. |
|
Still not working in VS2022 17.3, solved it by adding the folloiwing to the project file for the problematic project. The source is most like a very big "switch" statement |
#12322 is a related to processing very large expressions recursively, where these expressions are not already recognised as "linear".
Normally when processing F# expressions the depth is small, e.g. 10, though for some known "linear" sequences such as long lists of
letbindings, the depth may be arbitrarily large. We already code the compiler to handle these.However some potentially-linearizable expressions are not detected and it's really hard to detect and handle them properly systematically. Some examples include
A |> A |> A ...thing { 1;2;3;4;.. .}M(M(M(M(M....)We can at least guard against this kind of problem by jumping to a new thread stack when non-linear processing of deeply recursive is detected. This isn't ideal but it works.
Overall this protects us against the real problem of #12322 which is that stack depth varies on the six configurations of running our compiler
It does this by making much more of our deep-stack processing independent of actual available stack size.
Testing:
Manual testing notes for the whole matrix (except Windows v. Linux v. macOS)