[Mono-bugs] [Bug 462592] New: gmcs creates faulty code for slightly complex generics/ lambda sample

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 26 12:40:26 EST 2008


           Summary: gmcs creates faulty code for slightly complex
                    generics/lambda sample
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mono at e-tobi.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

The following code, if compiled with MS csc.exe, runs fine under Mono. Compiled
with Mono gmcs, it causes a runtime exception (on Mono as well as on MS .Net).
Therefore I assume, this is a compiler bug.

using System;

namespace testcase
    public interface IInitializationExpression
        void AddRegistry<T>();

    public class ConfigurationExpression
        public void AddRegistry<T>()

    public class InitializationExpression : ConfigurationExpression,

    public class Program
        private static void Main()
            Action<IInitializationExpression> action = x =>
            var expression = new InitializationExpression();

One thing to note: If I derive  ConfigurationExpression from
IInitializitationExpression, then it works fine.

The error output:

[mono-trunk] /tmp/testcase/testcase @ gmcs -debug test.cs
[mono-trunk] /tmp/testcase/testcase @ mono --debug test.exe
** ERROR:(method-to-ir.c:5902):mono_method_to_ir: assertion failed:
(!mono_method_check_context_used (cmethod))

  at (wrapper managed-to-native) object.__icall_wrapper_compile_generic_method
(object,intptr,intptr) <0x0004b>
  at (wrapper managed-to-native) object.__icall_wrapper_compile_generic_method
(object,intptr,intptr) <0xffffffff>
  at testcase.Program.<Main>m__0 (testcase.IInitializationExpression) [0x00000]
in /tmp/testcase/testcase/test.cs:25
  at testcase.Program.Main () [0x00024] in /tmp/testcase/testcase/test.cs:27
  at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono [0x47dc60]
        /lib/libpthread.so.0 [0x7fc588aaaa80]
        /lib/libc.so.6(gsignal+0x35) [0x7fc5884f7ed5]
        /lib/libc.so.6(abort+0x183) [0x7fc5884f93f3]
        /usr/lib/libglib-2.0.so.0(g_assertion_message+0x104) [0x7fc589123fe4]
        /usr/lib/libglib-2.0.so.0 [0x7fc589124482]
        mono [0x441939]
        mono [0x41d589]
        mono [0x41eda1]
        mono [0x459c1f]

Debug info from gdb:

[Thread debugging using libthread_db enabled]
[New Thread 0x7fc589783720 (LWP 21161)]
[New Thread 0x41ca6950 (LWP 21163)]
[New Thread 0x40ef4950 (LWP 21162)]
0x00007fc588592269 in syscall () from /lib/libc.so.6
  3 Thread 0x40ef4950 (LWP 21162)  0x00007fc588aaa0e1 in nanosleep () from
  2 Thread 0x41ca6950 (LWP 21163)  0x00007fc588aa8bd1 in sem_wait () from
  1 Thread 0x7fc589783720 (LWP 21161)  0x00007fc588592269 in syscall () from

Thread 3 (Thread 0x40ef4950 (LWP 21162)):
#0  0x00007fc588aaa0e1 in nanosleep () from /lib/libpthread.so.0
#1  0x0000000000556992 in collection_thread (unused=<value optimized out>) at
#2  0x00007fc588aa2fc7 in start_thread () from /lib/libpthread.so.0
#3  0x00007fc5885955ad in clone () from /lib/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x41ca6950 (LWP 21163)):
#0  0x00007fc588aa8bd1 in sem_wait () from /lib/libpthread.so.0
#1  0x000000000052734a in finalizer_thread (unused=<value optimized out>) at
#2  0x00000000005108d3 in start_wrapper (data=<value optimized out>) at
#3  0x0000000000558acb in thread_start_routine (args=0x23572f8) at
#4  0x000000000056eca2 in GC_start_routine (arg=0x7fc58962ee70) at
#5  0x00007fc588aa2fc7 in start_thread () from /lib/libpthread.so.0
#6  0x00007fc5885955ad in clone () from /lib/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fc589783720 (LWP 21161)):
#0  0x00007fc588592269 in syscall () from /lib/libc.so.6
#1  0x000000000047dd62 in mono_handle_native_sigsegv (signal=11, ctx=<value
optimized out>) at mini-exceptions.c:1406
#2  <signal handler called>
#3  0x00007fc5884f7ed5 in raise () from /lib/libc.so.6
#4  0x00007fc5884f93f3 in abort () from /lib/libc.so.6
#5  0x00007fc589123fe4 in g_assertion_message () from /usr/lib/libglib-2.0.so.0
#6  0x00007fc589124482 in g_assertion_message_expr () from
#7  0x0000000000441939 in mono_method_to_ir (cfg=0x23a1840, method=0x23a3f70,
start_bblock=0x239f528, end_bblock=0x239f628, return_var=0x0,
dont_inline=0x239bb20, inline_args=0x0, 
    inline_offset=0, is_virtual_call=0) at method-to-ir.c:5902
#8  0x000000000041d589 in mini_method_compile (method=0x23a3f70, opts=55667199,
domain=0x7fc58962de00, run_cctors=<value optimized out>, compile_aot=<value
optimized out>, parts=0)
    at mini.c:3173
#9  0x000000000041eda1 in mono_jit_compile_method (method=0x23a3f70) at
#10 0x0000000000459c1f in mono_helper_compile_generic_method
(obj=0x7fc5895d9ff0, method=<value optimized out>, this_arg=0x7fff917a66f0) at
#11 0x0000000040fef60b in ?? ()
#12 0x0000000002319610 in ?? ()
#13 0x00000000023209a0 in ?? ()
#14 0x0000000000000000 in ?? ()
#0  0x00007fc588592269 in syscall () from /lib/libc.so.6

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.

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