[Mono-bugs] [Bug 681067] New: F# generic type instantiation causes mono stack trace

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 19 11:38:09 EDT 2011


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

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


           Summary: F# generic type instantiation causes mono stack trace
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: wlrutledge at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:
I am using the Microsoft F# 2.0.0.0 November release on Ubuntu 10.10.  In
working through some exercises to better understand generic type handling, I
ran across a situation where I can define a type, but instantiating an instance
of the type causes a mono stack trace.

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 'a pizza =
-     Bottom
-     | Topping of ('a * ('a pizza))
-     
- type fish =
-     Anchovy
-     | Lox
-     | Tuna;;

type 'a pizza =
  | Bottom
  | Topping of ('a * 'a pizza)
type fish =
  | Anchovy
  | Lox
  | Tuna

> let rec rem_anchovy =
-     function
-         Bottom -> Bottom
-         | Topping(Anchovy, p) -> rem_anchovy(p)
-         | Topping(t, p) -> Topping(t, rem_anchovy(p))
-         
- let rec rem_tuna =
-     function
-         Bottom -> Bottom
-         | Topping(Tuna, p) -> rem_tuna(p)
-         | Topping(t, p) -> Topping(t, rem_tuna(p));;

val rem_anchovy : fish pizza -> fish pizza
val rem_tuna : fish pizza -> fish pizza

> let pizza1 = Topping(Lox, Topping(Tuna, Bottom));;
Stacktrace:

  at (wrapper managed-to-native) object.__icall_wrapper_mono_object_isinst
(object,intptr) <0x00050>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_object_isinst
(object,intptr) <0x00050>
  at (wrapper stelemref) object.stelemref (object,intptr,object) <0x0008f>
  at Microsoft.FSharp.Primitives.Basics.List.loop at 391-15<object>
(object[],int,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00053>
  at Microsoft.FSharp.Primitives.Basics.List.toArray<object>
(Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00077>
  at Microsoft.FSharp.Collections.ArrayModule.OfList<object>
(Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00053>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/Utilities.callGenericStaticMethod
(System.Type,string,Microsoft.FSharp.Collections.FSharpList`1<System.Type>,Microsoft.FSharp.Collections.FSharpList`1<object>)
<0x00077>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiValuePrinter.PrintValue
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiValuePrinterMode,Internal.Utilities.StructuredFormat.FormatOptions,object,System.Type)
<0x001b7>
  at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiValuePrinter.InvokeDeclLayout
(Microsoft.FSharp.Compiler.Env/TcGlobals,Microsoft.FSharp.Compiler.AbstractIL.RuntimeWriter/emEnv,Microsoft.FSharp.Compiler.Ilxgen/IlxGenEnv,Microsoft.FSharp.Compiler.Tast/Val)
<0x0033b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/denv at 936.Invoke
(Microsoft.FSharp.Compiler.Tast/Val) <0x0002b>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.nonMemberValSpecLP
(Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Tast/Typar>,Microsoft.FSharp.Compiler.Tast/Val,Microsoft.FSharp.Compiler.Tast/typ,Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<Microsoft.FSharp.Compiler.Tast/Typar,
Microsoft.FSharp.Compiler.Tast/TyparConstraint>>) <0x0042c>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.valLP
(Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/Val)
<0x001f7>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint/imdefLP at 4006-3.Invoke
(Microsoft.FSharp.Compiler.Tast/Val) <0x00023>
  at Microsoft.FSharp.Primitives.Basics.List.map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00057>
  at Microsoft.FSharp.Collections.ListModule.Map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x0002f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imdefLP at 3997
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x00323>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint/imdefLP at 3997-1.Invoke
(Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x00033>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2940-1<object, object,
object, object>.Invoke (object,object) <0x00036>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2927<object, object,
object>.Invoke (object) <0x0002c>
  at Microsoft.FSharp.Primitives.Basics.List.map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00057>
  at Microsoft.FSharp.Collections.ListModule.Map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x0002f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imdefLP at 3997
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x003a3>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint/imbindLP at 4011-1.Invoke
(Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceBinding) <0x00297>
  at Microsoft.FSharp.Primitives.Basics.List.map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00057>
  at Microsoft.FSharp.Collections.ListModule.Map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x0002f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imdefLP at 3997
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x0021f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint/imdefLP at 3997-1.Invoke
(Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x00033>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2940-1<object, object,
object, object>.Invoke (object,object) <0x00036>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2927<object, object,
object>.Invoke (object) <0x0002c>
  at Microsoft.FSharp.Primitives.Basics.List.map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00057>
  at Microsoft.FSharp.Collections.ListModule.Map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x0002f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imdefLP at 3997
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x003a3>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint/imdefLP at 3997-1.Invoke
(Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x00033>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2940-1<object, object,
object, object>.Invoke (object,object) <0x00036>
  at Microsoft.FSharp.Core.OptimizedClosures/Invoke at 2927<object, object,
object>.Invoke (object) <0x0002c>
  at Microsoft.FSharp.Primitives.Basics.List.map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x00057>
  at Microsoft.FSharp.Collections.ListModule.Map<object, object>
(Microsoft.FSharp.Core.FSharpFunc`2<object,
object>,Microsoft.FSharp.Collections.FSharpList`1<object>) <0x0002f>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imdefLP at 3997
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tastops/NicePrint/Path,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExpr)
<0x003a3>
  at Microsoft.FSharp.Compiler.Tastops/NicePrint.imexprL at 3993
(bool,Microsoft.FSharp.Compiler.Tastops/DisplayEnv,Microsoft.FSharp.Compiler.Tast/ModuleOrNamespaceExprWithSig)
<0x0003f>
  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>)
<0x00ee3>
  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>)
<0x001e7>
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo at 1571-39.Invoke
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x012a7>
  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>)
<0x00617>
  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)
<0x0010a>
  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]
    /usr/bin/cli() [0x4d275f]
    /lib/libpthread.so.0(+0xfb40) [0x7fbafe182b40]
    /usr/bin/cli() [0x47d458]
    /usr/bin/cli(mono_class_init+0x132) [0x4e3362]
    /usr/bin/cli(mono_class_init+0x806) [0x4e3a36]
    /usr/bin/cli(mono_class_init+0x7c3) [0x4e39f3]
    /usr/bin/cli(mono_class_is_assignable_from+0x108) [0x4e6f98]
    /usr/bin/cli(mono_object_isinst+0x6c) [0x4fbafc]
    [0x41245f20]

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 SIGSEGV 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:
On Windows 7 and Visual Studio 2010 the F# interpreter returns the following
for the same code:

val pizza1 : fish pizza = Topping (Lox, Topping (Tuna, Bottom))

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