[Mono-bugs] [Bug 576343] New: Reflection.Emit emiting bad IL opcodes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 2 19:49:09 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=576343

http://bugzilla.novell.com/show_bug.cgi?id=576343#c0


           Summary: Reflection.Emit emiting bad IL opcodes
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: PC
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: aChrisSmith at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner
           Blocker: No


Description of Problem:

When using the F# Interactive window (Reflection.Emit) the Mono runtime is
crashing after hitting some bad IL. Note that the same code compiles just fine
with the regular F# compiler. (I suspect this has to do with tail calls.)

Steps to reproduce the problem:
1. Download the latest F# CTP at:
http://www.microsoft.com/downloads/details.aspx?FamilyID=b55f0532-ac3c-4106-918c-5586a953a7da&displaylang=en
2. Run the F# Interactive console (fsi.exe) under Mono
3. Input the given text and boom.

Actual Results:

Compiles just fine.

Expected Results:

Runtime crash from hitting back IL.

How often does this happen? 

Every time.

Additional Information:

Here is a console session illustrating the problem:
-----------------------------
D:\FSharp\Oct 2009 CTP\bin>fsi.exe

Microsoft F# Interactive, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.7.8, compiling for .NET Framework Version v2.0.50727

For help type #help;;

>     type A() = class end
-     type B() = inherit A()
-
-     let f2 x =
-       let rec g1 (c : #A) y = (g2 c (y-1) |> ignore) 
-       and g2 (c : #A) y = (if (y >= 0) then (g1 (c) (y-1) ))
-       g1 (new B()) 3
-
-     f2 3;;

type A =
  class
    new : unit -> A
  end
type B =
  class
    inherit A
    new : unit -> B
  end
val f2 : 'a -> unit

> #q;;

D:\FSharp\Oct 2009 CTP\bin>mono fsi.exe

Microsoft F# Interactive, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.7.8, compiling for .NET Framework Version v2.0.50727

For help type #help;;

>     type A() = class end
    type B() = inherit A()

    let f2 x =
      let rec g1 (c : #A) y = (g2 c (y-1) |> ignore) 
      and g2 (c : #A) y = (if (y >= 0) then (g1 (c) (y-1) ))
      g1 (new B()) 3

    f2 3;;
System.InvalidProgramException: Invalid IL code in FSI_0002:g2 at 6<b> (b,int):
IL_
0030: or


  at FSI_0002.g2 at 6[B] (B c, Int32 y) [0x00000] in <filename unknown>:0
  at FSI_0002.f2[Int32] (Int32 x) [0x00000] in <filename unknown>:0
  at <StartupCode$FSI_0002>.$FSI_0002.main@ () [0x00000] in <filename
unknown>:0

  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(ob
ject,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invoke
Attr, System.Reflection.Binder binder, System.Object[] parameters,
System.Global
ization.CultureInfo culture) [0x00000] in <filename unknown>:0
Stopped due to error
> #q;;

-- 
Configure bugmail: http://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