[Mono-bugs] [Bug 522789] New: Invalid IL generated for anonymous generic function

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 16 14:47:08 EDT 2009


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


           Summary: Invalid IL generated for anonymous generic function
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: x86-64
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: harinath at hurrynot.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1)
Gecko/20090707 Iceweasel/3.5 (Debian-3.5-1)

The following testcase creates invalid IL

-------8<------
class G<T> {
    public T def () { return default (T); }
}

class C {
    delegate void DF ();
    static DF df;
    static void foo (object o) {}
    static void cf<T> ()
    {
        G<T> g = new G<T> ();
        df = delegate { foo (g.def ()); };
    }

    static void Main ()
    {
        cf<int> ();
        df ();
    }
}
-------8<------

Reproducible: Always

Steps to Reproduce:
Compile and run monodis on the resulting assembly
Actual Results:  
    // method line 12
    .method assembly hidebysig 
           instance default void '<>m__0' ()  cil managed 
    {
        // Method begins at RVA 0x2164
    // Code size 22 (0x16)
    .maxstack 8
    IL_0000:  ldarg.0 
    IL_0001:  ldfld class G`1<!0> class C/'<cf>c__AnonStorey0`1'<!0>::g
    IL_0006:  callvirt instance !0 class G`1<!T>::def()

** (process:24552): WARNING **: Encountered a generic type inappropriate for
its context
    IL_000b:  box @!#$<InvalidType>$#!@ // !!0
    IL_0010:  call void class C::foo(object)
    IL_0015:  ret 
    } // end of method <cf>c__AnonStorey0`1::<>m__0


Expected Results:  
The offending line IL_000b should read 'box !0'

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