Skip to content
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

Compiler hangs wne compiling inline recursive invocation #17376

Closed
miegir opened this issue Jul 2, 2024 · 2 comments · Fixed by #17394
Closed

Compiler hangs wne compiling inline recursive invocation #17376

miegir opened this issue Jul 2, 2024 · 2 comments · Fixed by #17394
Assignees
Labels
Area-Compiler-Optimization The F# optimizer, release code gen etc. Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Regression
Milestone

Comments

@miegir
Copy link

miegir commented Jul 2, 2024

Repro steps

  1. Create a new F# project with the following code in Program.fs:
let rec inline test m = test m in test 0
  1. Compile the project using dotnet build.

In fact, any recursive inline function can be declared and then invoked somewhere.

Expected behavior

Compiler is expected to output some error because inline rec functions are not allowed and quit.

Actual behavior

Compiler outputs several errors and warnings and then hangs with continuously increasing memory consumption. Compiler output before hang (with paths stripped):

Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]
Program.fs(1,25): warning FS1116: A value marked as 'inline' has an unexpected value [TestApp.fsproj]
Program.fs(1,25): warning FS1118: Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline' [TestApp.fsproj]
Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]
Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]

N.B. This bug is contrived of course. I never thought of writing such code in real applications.

@github-actions github-actions bot added this to the Backlog milestone Jul 2, 2024
@Martin521
Copy link
Contributor

Martin521 commented Jul 2, 2024

For me (net8) the compiler runs (with similar error messages) and finishes normally.
Which SDK / compiler / TFM are you using?

@Martin521
Copy link
Contributor

Martin521 commented Jul 5, 2024

Actually, after updating from 8.0.206 to 8.0.302 I have exactly the behavior described in the OP.

@T-Gro T-Gro added Area-Compiler-Optimization The F# optimizer, release code gen etc. Regression Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. and removed Needs-Triage labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-Optimization The F# optimizer, release code gen etc. Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Regression
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants