[Mono-bugs] [Bug 619192] New: gmcs generates unverifiable code for a null coalescing expression involving generic parameters

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 1 10:32:50 EDT 2010


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

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


           Summary: gmcs generates unverifiable code for a null coalescing
                    expression involving generic parameters
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: x86-64
        OS/Version: openSUSE 11.2
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rodrigobamboo at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.1
(KHTML, like Gecko) Chrome/6.0.427.0 Safari/534.1

gmcs generates unverifiable code for the following valid c# program:

public static class CoalescingWithGenericsBug
{
    class Service { public void Foo() {} }

    static void Main(string[] args)
    {
        Provide<Service>().Foo();
    }

    static T Provide<T>() where T: class
    {
        return FindExisting<T>() ?? System.Activator.CreateInstance<T>();
    }

    static T FindExisting<T>() where T: class
    {
        return null;
    }
}

'pedump --verify code' complains with:

In method: CoalescingWithGenericsBug::Provide()
Not Verifiable: Argument type Complex not valid for brtrue/brfalse at 0x0006

It turns out gmcs is missing a 'box !! T' before the brtrue instruction
indicated above.

Reproducible: Always

Steps to Reproduce:
1. save the c# code to CoalescingWithGenericsBug.cs
2. gmcs CoalescingWithGenericsBug.cs && pedump --verify code
CoalescingWithGenericsBug.exe

3.
Actual Results:  
In method: CoalescingWithGenericsBug::Provide()
Not Verifiable: Argument type Complex not valid for brtrue/brfalse at 0x0006

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