[Mono-bugs] [Bug 671552] New: dmcs generates invalid code from generics/iterator/anon methods code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Feb 12 18:49:19 EST 2011


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

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


           Summary: dmcs generates invalid code from
                    generics/iterator/anon methods code
    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: vargaz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public static class IEnumerableTransform {

    public static IEnumerable<TOut> Transform<TOut> (this IEnumerable<int>
input, EmitterFunc<TOut> rule) {
        foreach (var v in input) {
            TOut output;
            rule (out output);
            yield return output;
        }
    }

    public static EmitterFunc<TOut> Emit<TOut> (TOut result) {
        return delegate (out TOut output) {
            output = result;
        };
    }

    public delegate void EmitterFunc<TOut> (out TOut output);

    public static void Main () {
        IEnumerable<int> arr = new int [10];
        Console.WriteLine (arr.Transform<char> (IEnumerableTransform.Emit<char>
('t')).ToArray ());
    }
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

When running the code compiled by dmcs, both the mono and the MS runtime crash,
mono --verify reports:

Unhandled Exception: System.BadImageFormatException: Error verifying
IEnumerableTransform/<Emit>c__AnonStorey1`1:<>m__0 (TOut&): Invalid generic
type (!!!!0) (argument out of range or method is not generic) at 0x0007

This happens with both HEAD and 2.10.

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