Bug 24752 - stack overflow when running F# compiler included with mono
Summary: stack overflow when running F# compiler included with mono
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-22 09:23 UTC by Keith Sheppard
Modified: 2015-05-12 16:18 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Keith Sheppard 2014-11-22 09:23:49 UTC
This bug was reproduced on OS X with mono version 3.10.0 (which is not available in the version field for bug reports) and on ubuntu with mono mono 3.2.8:

The F# compiler included with mono exits with a stack overflow error when the --sig option is used to generate an F# signature file. This same compile completes with no errors using microsoft's runtime on windows. You can reproduce this error by doing the following:

git clone git@github.com:fsprojects/llvm-fs.git
cd llvm-fs/
git checkout 584fd09f9f56899d03e44a453fd47a25b4ecd106
fsharpc --nologo --debug --target:library --sig:LLVMFSharp.sig --out:LLVMFSharp.dll src/LLVM/FFIUtil.fs src/LLVM/Generated.fs src/LLVM/Core.fs src/LLVM/BitReader.fs src/LLVM/ExecutionEngine.fs src/LLVM/Extra.fs src/LLVM/Target.fs src/LLVM/Quote.fs

Which generates this exception:
===============================

Stack overflow in unmanaged: IP: 0x12d2fc, fault addr: 0xbf77fdec

error FS0193: internal error: The requested operation caused a stack overflow.

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 

==================================

Removing the --sig option allows the compile to complete successfully with mono:

fsharpc --nologo --debug --target:library --out:LLVMFSharp.dll src/LLVM/FFIUtil.fs src/LLVM/Generated.fs src/LLVM/Core.fs src/LLVM/BitReader.fs src/LLVM/ExecutionEngine.fs src/LLVM/Extra.fs src/LLVM/Target.fs src/LLVM/Quote.fs
Comment 1 Zoltan Varga 2014-11-29 20:39:56 UTC
I can reproduce this with mono master too.

Note You need to log in before you can comment on or make changes to this bug.