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


           Summary: Mono runtime complains about invalid IL generated by
                    gmcs
           Product: Mono: Compilers
           Version: 2.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


The code below compiles with gmcs v2.0.1.0 but gets the following runtime error
when run with mono v2.0.1 on OpenSUSE 11:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
OneOff:Clone (double[]): IL_0078: box       0x1b000001

Exact same exe runs fine with MS CLR 2.0 on Windows, so seems to be less about
the code generated than about the runtime.


using System;

public class OneOff
{
        public static void Main(string[] args)
  {
    double[] darray = { 1.0, 2.0, 3.0 };
    double[] clone = OneOff.Clone(darray);
    Console.WriteLine(clone.Length);
  }

  private static T[] Clone<T>(T[] o)
  {
    if (o == null)
      return null;
    Type t = typeof(T);
    if (t.IsValueType)
      return (T[])o.Clone();
    else if (t.IsArray && (t.GetElementType().IsValueType ||
t.GetElementType()==typeof(string)))
    {
      T[] copy = new T[o.Length];
      for (int i = 0; i < o.Length; i++)
        copy[i] = (T)(o[i] as Array).Clone();
      return copy;
    }
    else
      throw new ArgumentException("oops");
  }
}


-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to