[Mono-bugs] [Bug 662108] New: mcs emits invalid IL on as operator for nullable types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 3 14:37:41 EST 2011


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

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


           Summary: mcs emits invalid IL on as operator for nullable types
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: gnorton at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


marek,

  The following C#:


using System;

class T {
        public static string Convert (int a) {
        return Convert (a as int?);
    }

    public static string Convert (int? a) {
        return null;
    }
}


for the T:Convert(int) method emits:


    .method public static  hidebysig 
           default string Convert (int32 a)  cil managed 
    {
        // Method begins at RVA 0x20f4
    // Code size 17 (0x11)
    .maxstack 8
    IL_0000:  ldarg.0 
    IL_0001:  newobj instance void valuetype
[mscorlib]System.Nullable`1<int32>::'.ctor'(!0)
    IL_0006:  unbox.any valuetype [mscorlib]System.Nullable`1<int32>
    IL_000b:  call string class T::Convert(valuetype
[mscorlib]System.Nullable`1<int32>)
    IL_0010:  ret 
    } // end of method T::Convert

The unbox.any is invalid, csc doesn't emit it (altho it does a local store, but
I presume thats for the debugger).

This affects monotouch as well, so any chance of a fix on 2.6 as well as
master/2.8?  Thanks

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


More information about the mono-bugs mailing list