[Mono-bugs] [Bug 448560] New: gmcs emits unverifiable code (missing unbox.any)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 25 05:18:26 EST 2008


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


           Summary: gmcs emits unverifiable code (missing unbox.any)
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkvinge at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Repro:
class T {
        public P GetService <P> () where P : class
        {
                object o = null;
                return o as P;
        }
}

gmcs il:
method public hidebysig instance !!P GetService<class P>() cil managed
{
    .maxstack 2
    .locals init (
        [0] object obj2)
    L_0000: ldnull 
    L_0001: stloc.0 
    L_0002: ldloc.0 
    L_0003: isinst !!P
    L_0008: ret 
}

csc il:
method public hidebysig instance !!P GetService<class P>() cil managed
{
    .maxstack 1
    .locals init (
        [0] object obj2)
    L_0000: ldnull 
    L_0001: stloc.0 
    L_0002: ldloc.0 
    L_0003: isinst !!P
    L_0008: unbox.any !!P
    L_000d: ret 
}

peverify says:
[IL]: Error: [test.dll : T::GetService[P]][offset 0x00000008][found ref (boxed)
'P'][expected (unboxed) 'P'] Unexpected type on the stack.
1 Error(s) Verifying test.dll


Note that 'return (P) o;' compiles correctly.


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