Skip to content

Compiler hangs wne compiling inline recursive invocation #17376

@miegir

Description

@miegir

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.

Metadata

Metadata

Assignees

Labels

Area-Compiler-OptimizationThe F# optimizer, release code gen etc.BugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Regression

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions