在单声道下运行的F#编译器中的堆栈溢出

时间:2014-11-21 03:52:46

标签: f# mono stack-overflow llvm-fs

我正在为我的项目llvm-fs更新工具,所以我安装了新版本的mono并尝试编译它。在OS X下使用mono 3.10.0 {1}}或在ubuntu下使用fsharpc 3.1 mono 3.2.8编译失败,堆栈溢出:

fsharpc 3.0

您可以通过执行以下操作在Linux或OS X上重现此错误:

Unhandled Exception:
System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 

在Windows git clone git@github.com:fsprojects/llvm-fs.git cd llvm-fs/ FSC=fsharpc ./build.bash 下,编译完成且没有错误:

fsc 12.0.30815.0

这是一个已知问题,有什么方法可以解决它吗?我尝试将不同的选项传递给单声道运行时,没有一个导致编译器正常退出。我记得在过去单声道有一些关于尾部指令的问题,但我认为这些问题大多已经解决了。谢谢!

1 个答案:

答案 0 :(得分:1)

这对于注释来说太长了,但错误是由来自generated.fs的这段代码触发的(在其中注释掉它会停止堆栈溢出 - 一旦注释掉后会出现错误)(来自行6496-6506):

 [<DllImport(
            llvmAssemblyName,
            EntryPoint="LLVMRunFunction",
            CallingConvention=CallingConvention.Cdecl,
            CharSet=CharSet.Ansi)>]
        extern void* (* LLVMGenericValueRef *) runFunctionNative(
            void* (* LLVMExecutionEngineRef *) EE,
            void* (* LLVMValueRef *) F,
            uint32 NumArgs,
            void* (* LLVMGenericValueRef* *) Args)
        // I don't know how to generate an "F# friendly" version of LLVMRunFunction

在输出签名文件的代码中发生崩溃。

禁用签名文件可以解决问题(但某处仍存在潜在的错误)。