[Mono-bugs] [Bug 408361] New: [GMCS] Produces bad IL when compiling a combination of generics and yield return statements .

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jul 11 09:33:49 EDT 2008


           Summary: [GMCS] Produces bad IL when compiling a combination of
                    generics and yield return statements.
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: Vernish13 at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

gmcs produces bad IL when compiling a combination of generic classes and yield
return statements.

The following example compiles and runs successfully when using csc to compile. 

To reproduce compile and run the following:

using System;
using System.Collections.Generic;

public class Test
    public static void Main(string[] args)
        Foo<int> nav = new Foo<int>();
        IEnumerable<int> t = TestRoutine<int>(new int[] { 1 }, nav);
        new List<int>(t);
    public static IEnumerable<T> TestRoutine<T>(IEnumerable<T> a, Foo<T> f)
        foreach (T n in a)
            yield return n;

public class Foo<T>
    public void CreateItem<G>()

Expected Error Output:

** ERROR **: file mini.c: line 5754 (mono_method_to_ir): assertion failed:
(!mono_method_check_context_used (cmethod))

  at System.Collections.Generic.List`1.AddEnumerable
(System.Collections.Generic.IEnumerable`1) <0xffffffff>
  at System.Collections.Generic.List`1.AddEnumerable
(System.Collections.Generic.IEnumerable`1) <0x00073>
  at System.Collections.Generic.List`1..ctor
(System.Collections.Generic.IEnumerable`1) <0x000cf>
  at Test.Main (string[]) <0x0008f>
  at (wrapper runtime-invoke) Test.runtime_invoke_void_string[]
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono [0x429d85]
        mono [0x5c9ff6]
        /lib64/tls/libpthread.so.0 [0x355080c4f0]
        /lib64/tls/libc.so.6(gsignal+0x3d) [0x354ff2e21d]
        /lib64/tls/libc.so.6(abort+0xfe) [0x354ff2fa1e]
        /usr/lib64/libglib-2.0.so.0 [0x355222ed28]
        /usr/lib64/libglib-2.0.so.0(g_log+0x83) [0x355222edb3]
        mono [0x5a5151]
        mono [0x5c747b]
        mono [0x5c8e5e]
        mono [0x5c96a0]
        mono [0x5c97ab]
        mono(mono_compile_method+0x46) [0x4d1cf9]
        mono [0x42ad9a]

Debug info from gdb:

thread apply all bt: No such file or directory.

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Expected Correct Output:

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