Stack overflow when a quotation contains a list literal of about a thousand elements
Los mantenedores suelen responder en 3 días
@T-Gro ya está trabajando en esto.
Desde el 16/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- fsharp
- Área
- compilers
Línea de trabajo
The crash is in QuotationTranslator.fs, where ConvExprCore and ConvExpr recurse once per list element; the repro in the issue (a quotation with a 1500-element list literal, run with dotnet fsi) reproduces it. Compare with how StackGuard is applied in the type checker and PostInferenceChecks, which the issue notes this file lacks. Done means the repro script prints done and the existing quotation tests still pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
QuotationTranslator recurses once per element of a list literal and has no stack guard, so a quotation that contains a long list literal crashes the compiler with a stack overflow.
Repro steps
- Generate a script with a list literal of 1500 elements inside a quotation:
// gen.fsx
let elements = String.concat "; " [ for i in 1..1500 -> string i ]
System.IO.File.WriteAllText("repro.fsx", "let q = <@ [ " + elements + " ] @>\nprintfn \"done\"")
- Run
dotnet fsi gen.fsx, thendotnet fsi repro.fsx.
Expected behavior
The script prints done. The same list literal outside a quotation compiles (tried 5000 elements), and so does [| ... |] inside a quotation (tried 10000).
Actual behavior
The process crashes:
Stack overflow.
at FSharp.Compiler.TypedTreeOps.TupleCompilation.|Let|_|(Expr)
at FSharp.Compiler.TypedTreeOps.TupleCompilation.|CompiledForEachExpr|_|(TcGlobals, Expr)
at FSharp.Compiler.TypedTreeOps.TupleCompilation.|CompiledInt32RangeForEachExpr|_|(TcGlobals, Expr)
at FSharp.Compiler.TypedTreeOps.TupleCompilation.DetectAndOptimizeForEachExpression(TcGlobals, OptimizeForExpressionOptions, Expr)
Repeated 1165 times:
--------------------------------
at FSharp.Compiler.QuotationTranslator.ConvExprCore(QuotationGenerationScope, QuotationTranslationEnv, Expr)
at FSharp.Compiler.QuotationTranslator.ConvExpr(QuotationGenerationScope, QuotationTranslationEnv, Expr)
at Microsoft.FSharp.Primitives.Basics.List.mapToFreshConsTail[...]
at Microsoft.FSharp.Primitives.Basics.List.map[...]
--------------------------------
at FSharp.Compiler.QuotationTranslator.ConvExprCore(QuotationGenerationScope, QuotationTranslationEnv, Expr)
at FSharp.Compiler.QuotationTranslator.ConvExpr(QuotationGenerationScope, QuotationTranslationEnv, Expr)
at FSharp.Compiler.QuotationTranslator.ConvExprPublic(QuotationGenerationScope, Boolean, Expr)
at FSharp.Compiler.PostTypeCheckSemanticChecks.doData@1416(...)
The threshold in dotnet fsi is between 800 and 1000 elements on SDK 10.0.402 and between 1000 and 1250 on SDK 11.0.100-rc.2. QuotationTranslator.fs does not use StackGuard, unlike the type checker and PostInferenceChecks.
It was found while compiling tests/fsharp/typeProviders/helloWorld/provider.fsx in the FSharp.Compiler.ComponentTests host: a quotation there with a list of a few dozen elements overflowed with a Debug build of the compiler on a thread-pool thread.
Known workarounds
Use an array literal.
Related information
- Windows 11, x64
- .NET Core (SDK 10.0.402 and 11.0.100-rc.2.26504.105,
dotnet fsi)
- Lenguaje dominante
- F#
- Estrellas
- 4.3k
- Forks
- 881
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 105
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/fsharp
-
`FSharpValue.PreComputeTuplePropertyInfo` reports an out-of-range index for every struct tupleAbiertoBug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 3 días
-
Bug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
Documentation: Array.tryPick code example gives an errorPosiblemente ocupada @T-Gro la tomó hace 2 días. AbiertoArea-XmlDocs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
dotnet/fsharp#20780 · 1 asignado ·
Los mantenedores suelen responder en 3 días
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)Posiblemente ocupada @xperiandri la tomó hace 44 días. AbiertoNeeds-Triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 3 días
-
Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/fsharp#20265 · 1 comentario ·
Los mantenedores suelen responder en 3 días
Todos los issues de dotnet/fsharp
Issues similares
-
bug priority: P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
crash lld:MachO
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
llvm/llvm-project#233265 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
snowballstem/snowball#311 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
JakeChampion/lang#12684 ·
Los mantenedores suelen responder en 1 día
-
`lvm_compact` has no self-hosted twin, and `docs/158` §5 says every language-face component mustAbiertobug sev-3 vm
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100