Bug 16883 - F# interpreter crashes with code that runs when compiled
Summary: F# interpreter crashes with code that runs when compiled
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-12-18 14:05 UTC by Andrei Formiga
Modified: 2014-01-04 18:51 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andrei Formiga 2013-12-18 14:05:13 UTC
I specified "Reflection" as component because the stack trace mentions Reflection, but I have no idea if this is the right component for the bug. 

Using F# 3.0 with Mono 3.4.2 on OS X 10.9. The F# compiler and interpreter are the ones that came with the Mono download for OS X. 

A stripped-down test case is the following: 

module Test 

type D<'T when 'T : comparison> = 
    abstract GetX : 'T 

let someX x = { 
    new D<'T> with 
        member d.GetX = x } 

When running fsharpi and doing

> #load "test.fs" 
> open Test 
> let d1 = someX 10.0 
> d1.GetX 

the last line makes the mono runtime crash. Compiling this code instead of calling it from the interpreter works fine. 

The (abridged) error output is: 

* Assertion at mini-trampolines.c:629, condition `*vtable_slot_to_patch' not met 

Stacktrace: 

  at <unknown> <0xffffffff> 
  at <StartupCode$FSI_0007>.$FSI_0007.main@ () <0x00019> 
  at (wrapper runtime-invoke) object.runtime_invoke_void 
(object,intptr,intptr,intptr) <0xffffffff> 
  at <unknown> <0xffffffff> 
  at (wrapper managed-to-native) 
System.Reflection.MonoMethod.InternalInvoke 
(System.Reflection.MonoMethod,object,object[],System.Exception&) 
<0xffffffff> 
  at System.Reflection.MonoMethod.Invoke 
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) 
<0x000af> 
  at System.MonoType.InvokeMember 
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[]) 
<0x00338> 
  at System.Reflection.Emit.TypeBuilder.InvokeMember 
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[]) 
<0x00040> 
  at System.Type.InvokeMember 
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Globalization.CultureInfo) 
<0x0002c> 
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/execEntryPtFun@2098-1.Invoke 
(Microsoft.FSharp.Core.Unit) <0x0007b> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo@958-34.Invoke 
(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit, 
Microsoft.FSharp.Core.FSharpOption`1<System.Exception>>) <0x00014> 
  at Microsoft.FSharp.Primitives.Basics.List.iter<T> 
(Microsoft.FSharp.Core.FSharpFunc`2<T, 
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T>) 
<0x00036> 
  at Microsoft.FSharp.Collections.ListModule.Iterate<T> 
(Microsoft.FSharp.Core.FSharpFunc`2<T, 
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T>) 
<0x0002b> 
  at Microsoft.FSharp.Compiler.Interactive.Shell.arg10@957 
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit, 
Microsoft.FSharp.Core.FSharpOption`1<System.Exception>>>,Microsoft.FSharp.Core.Unit) 
<0x0004f> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.ProcessInputs 
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/ParsedInput>,bool,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/Ident>) 
<0x006ab> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedDefinitions 
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/SynModuleDecl>) 
<0x001a7> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedExpression 
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/SynExpr) 
<0x00047> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo@1701-41.Invoke 
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) 
<0x01267> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.InteractiveCatch<a> 
(Microsoft.FSharp.Core.FSharpFunc`2<a, System.Tuple`2<a, 
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionStepStatus>>,a) 
<0x0003c> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteraction 
(bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction) 
<0x0004f> 
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteractions 

*** more stack trace from managed stack...

*** native stack trace...

Executing commands in '/tmp/mono-gdb-commands.iIfyDL'. 
(lldb)  process attach --pid 10163 
Process 10163 stopped 
Executable module set to "/usr/bin/mono". 
Architecture set to: i486-apple-macosx. 
(lldb)  script lldb.debugger.HandleCommand ("thread list") 
(lldb)  script lldb.debugger.HandleCommand ("thread backtrace all") 
(lldb)  detach 
Detaching from process 10163 
(lldb)  quit 
error: Aborting reading of commands after command #4: 'quit' failed 
with <unknown error>. 
Process 10163 detached 
(lldb) 
================================================================= 
Got a SIGABRT while executing native code. This usually indicates 
a fatal error in the mono runtime or one of the native libraries 
used by your application. 
=================================================================
Comment 1 Zoltan Varga 2014-01-04 18:51:31 UTC
Fixed in master a4070ceb604ea1864b3771ca13ad03ec063f044f.