[Mono-bugs] [Bug 680542] New: F# generic type example exposes problem in mono runtime

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 17 12:07:02 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=680542

https://bugzilla.novell.com/show_bug.cgi?id=680542#c0


           Summary: F# generic type example exposes problem in mono
                    runtime
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: wlrutledge at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User
           Blocker: ---


Description of Problem:
I was translating code from the book The Little MLer to F# in order to learn
F#.  I am using the Microsoft F# 2.0.0.0 November release on Ubuntu.  The
sample code was compiled by the fsi.exe interpreter, but trying a simple
example causes the mono runtime to die.

warren at xenophon:~$ mono --version
Mono JIT compiler version 2.6.7 (Debian 2.6.7-3ubuntu1)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC and Parallel Mark)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none


Steps to reproduce the problem:
warren at xenophon:~$ fsi.exe

Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #light
- 
- 
- 
- type shish_kebab =
- 
-     Skewer
- 
-     | Onion of shish_kebab
- 
-     | Lamb of shish_kebab
- 
-     | Tomato of shish_kebab
- 
- 
- 
- let rec only_onions =
- 
-     function
- 
-         Skewer -> true
- 
-         | Onion(x) -> only_onions(x)
- 
-         | Lamb(x) -> false
- 
-         | Tomato(x) -> false
- 
- 
- 
- let rec is_vegetarian =
- 
-     function
- 
-         Skewer -> true
- 
-         | Onion(x) -> is_vegetarian(x)
- 
-         | Lamb(x) -> false
- 
-         | Tomato(x) -> is_vegetarian(x)
- 
- 
- 
- type 'a shish =
- 
-     Bottom of 'a
- 
-     | Onion of 'a shish
- 
-     | Lamb of 'a shish
- 
-     | Tomato of 'a shish
- 
- 
- 
- type rod =
- 
-     Dagger
- 
-     | Fork
- 
-     | Sword
- 
- 
- 
- type plate =
- 
-     Gold_plate
- 
-     | Sliver_plate
- 
-     | Brass_plate
- 
- 
- 
- let rec is_veggie =
- 
-     function
- 
-         Bottom(x) -> true
- 
-         | Onion(x) -> is_veggie(x)
- 
-         | Lamb(x) -> false
- 
-         | Tomato(x) -> is_veggie(x)
- 
- 
- 
- let rec what_bottom =
- 
-     function
- 
-         Bottom(x) -> x
- 
-         | Onion(x) -> what_bottom(x)
- 
-         | Lamb(x) -> what_bottom(x)
- 
-         | Tomato(x) -> what_bottom(x)
- 
- ;;

type shish_kebab =
  | Skewer
  | Onion of shish_kebab
  | Lamb of shish_kebab
  | Tomato of shish_kebab
val only_onions : shish_kebab -> bool
val is_vegetarian : shish_kebab -> bool
type 'a shish =
  | Bottom of 'a
  | Onion of 'a shish
  | Lamb of 'a shish
  | Tomato of 'a shish
type rod =
  | Dagger
  | Fork
  | Sword
type plate =
  | Gold_plate
  | Sliver_plate
  | Brass_plate
val is_veggie : 'a shish -> bool
val what_bottom : 'a shish -> 'a

> (Onion(Bottom(Dagger))) |> what_bottom;;
**
ERROR:mini-trampolines.c:444:mono_magic_trampoline: assertion failed:
(this_argument->vtable->klass->inited)
Stacktrace:

  at FSI_0002.what_bottom<object> (FSI_0002/shish`1<object>) <0xffffffff>
  at FSI_0002.what_bottom<object> (FSI_0002/shish`1<object>) <0x00030>
  at <StartupCode$FSI_0003>.$FSI_0003.main@ () <0x00047>
  at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr) <0x00049>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[],System.Exception&) <0x00068>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[],System.Exception&) <0x00068>
  at System.Reflection.MonoMethod.Invoke
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
<0x00187>
  at System.MonoType.InvokeMember
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
<0x0064b>
  at System.Reflection.Emit.TypeBuilder.InvokeMember
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
<0x0006c>
  at System.Type.InvokeMember
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Globalization.CultureInfo)
<0x0005d>
  at
Microsoft.FSharp.Compiler.AbstractIL.RuntimeWriter/execEntryPtFun at 1730-1.Invoke
(Microsoft.FSharp.Core.Unit) <0x0009b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo at 918-32.Invoke
(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,
Microsoft.FSharp.Core.FSharpOption`1<System.Exception>>) <0x00025>
  at Microsoft.FSharp.Primitives.Basics.List.iter<object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<object>)
<0x0004c>
  at Microsoft.FSharp.Collections.ListModule.Iterate<object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<object>)
<0x0002f>
  at Microsoft.FSharp.Compiler.Interactive.Shell.arg10 at 917
(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)
<0x00033>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.ProcessInputs<int>
(int,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/Input>,bool,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/ident>)
<0x00a9b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalDefns
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/SynModuleImplDecl>)
<0x001cb>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalExpr
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/SynExpr)
<0x002b7>
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo at 1571-39.Invoke
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x011f7>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.InteractiveCatch<object>
(Microsoft.FSharp.Core.FSharpFunc`2<object, System.Tuple`2<object,
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionStepStatus>>,object)
<0x0004a>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteraction
(bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/Interaction)
<0x00067>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteractions
(bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/Interaction>)
<0x0062b>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.MainThreadProcessParsedInteraction
(bool,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/Interaction>,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState)
<0x000e7>
  at Microsoft.FSharp.Compiler.Interactive.Shell/res at 1735.Invoke
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x00027>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/runCodeOnMainThread at 1937-2<object>.Invoke
(Microsoft.FSharp.Core.Unit) <0x0003f>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/Microsoft-FSharp-Compiler-Interactive-IEventLoop-Invoke at 1840<object>.Invoke
() <0x00045>
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__
(object,intptr,intptr,intptr) <0x00051>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[],System.Exception&) <0x00068>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[],System.Exception&) <0x00068>
  at System.Reflection.MonoMethod.Invoke
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
<0x00187>
  at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002d>
  at System.Delegate.DynamicInvokeImpl (object[]) <0x0018b>
  at System.MulticastDelegate.DynamicInvokeImpl (object[]) <0x0003b>
  at System.Delegate.DynamicInvoke (object[]) <0x0001b>
  at System.Windows.Forms.XplatUIDriverSupport.ExecutionCallback (object)
<0x0006b>
  at System.Security.SecurityContext.Run
(System.Security.SecurityContext,System.Threading.ContextCallback,object)
<0x0010e>
  at System.Threading.ExecutionContext.Run
(System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
<0x0003f>
  at System.Windows.Forms.XplatUIDriverSupport.ExecuteClientMessage
(System.Runtime.InteropServices.GCHandle) <0x0009b>
  at System.Windows.Forms.XplatUIX11.GetMessage
(object,System.Windows.Forms.MSG&,intptr,int,int) <0x030ef>
  at System.Windows.Forms.XplatUI.GetMessage
(object,System.Windows.Forms.MSG&,intptr,int,int) <0x0004f>
  at System.Windows.Forms.Application.RunLoop
(bool,System.Windows.Forms.ApplicationContext) <0x00e4b>
  at System.Windows.Forms.Application.Run
(System.Windows.Forms.ApplicationContext) <0x0005b>
  at System.Windows.Forms.Application.Run () <0x0002b>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/WinFormsEventLoop.Microsoft-FSharp-Compiler-Interactive-IEventLoop-Run
() <0x0005b>
  at Microsoft.FSharp.Compiler.Interactive.Shell.runLoop at 1983
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput,Microsoft.FSharp.Core.Unit)
<0x001db>
  at Microsoft.FSharp.Compiler.Interactive.Shell.DriveFsiEventLoop
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput) <0x0000f>
  at Microsoft.FSharp.Compiler.Interactive.Shell.main () <0x01b2f>
  at Microsoft.FSharp.Compiler.Interactive.Shell.MainMain (string[]) <0x0000b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object
(object,intptr,intptr,intptr) <0x00054>

Native stacktrace:

    /usr/bin/cli() [0x48563b]
    /lib/libpthread.so.0(+0xfb40) [0x7f792995eb40]
    /lib/libc.so.6(gsignal+0x35) [0x7f792937cba5]
    /lib/libc.so.6(abort+0x180) [0x7f79293806b0]
    /lib/libglib-2.0.so.0(g_assertion_message+0x144) [0x7f7929fde804]
    /lib/libglib-2.0.so.0(+0x66da0) [0x7f7929fdeda0]
    /usr/bin/cli() [0x489d26]
    [0x40abf168]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.

=================================================================
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.
=================================================================

Aborted
warren at xenophon:~$ 



Actual Results:


Expected Results:
This is what you get on Windows 7 running the same code in Visual Studio 2010.

val it : rod = Dagger

How often does this happen? 
Every time

Additional Information:

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list