[Mono-bugs] [Bug 648376] New: mono --llvm crashes when unsafe code contains 'stackalloc'-keyword

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 21 11:53:03 EDT 2010



           Summary: mono --llvm crashes when unsafe code contains
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: kummer at fdy.tu-darmstadt.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=396320)
 --> (http://bugzilla.novell.com/attachment.cgi?id=396320)
compiled with Microsoft csc, crashing with mono --llvm

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3

This is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonoBugTest {
    class Program {
        static void Main(string[] args) {
            unsafe {
                double* pd = stackalloc double[3];

                pd[0] = 0;
                pd[1] = 0;
                pd[2] = 0;

* the error only occurs when de code is compiled with Microsoft Compiler
  when compiled with Mono mcs, everything is fine;

* it seems that the runtime crashes during JIT-compilation, the method is not

Reproducible: Always

Steps to Reproduce:
1. Compile the Code above with Microsoft Visual Studio 2010 (or use provided
2. execute under Linux with mono --llvm 

Actual Results:  
mono: Instructions.cpp:1691: static llvm::BinaryOperator*
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion `S1->getType()
== S2->getType() && "Cannot create binary operator with two operands of
differing type!"' failed.

Native stacktrace:

    mono() [0x4922cb]
    /lib/libpthread.so.0(+0xf8f0) [0x7f1089c018f0]
    /lib/libc.so.6(gsignal+0x35) [0x7f108968ba75]
    /lib/libc.so.6(abort+0x180) [0x7f108968f5c0]
    /lib/libc.so.6(__assert_fail+0xf1) [0x7f1089684941]
    mono() [0xbd675d]
    mono() [0xb9db95]
    mono() [0x4c74c7]
    mono() [0x420f2a]
    mono() [0x422d2f]
    mono() [0x423929]
    mono(mono_runtime_invoke+0x4b) [0x58ebcb]
    mono(mono_runtime_exec_main+0xd3) [0x592463]
    mono(mono_main+0x18ef) [0x47189f]
    /lib/libc.so.6(__libc_start_main+0xfd) [0x7f1089676c4d]
    mono() [0x418939]

Debug info from gdb:

Mono support loaded.
[Thread debugging using libthread_db enabled]
[New Thread 0x7f1087ca8710 (LWP 3096)]
[New Thread 0x7f1089657710 (LWP 3095)]
0x00007f1089c0093d in read () from /lib/libpthread.so.0
  3 Thread 0x7f1089657710 (LWP 3095)  0x00007f1089bfd85c in
pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  2 Thread 0x7f1087ca8710 (LWP 3096)  0x00007f1089bffb50 in sem_wait ()
   from /lib/libpthread.so.0
* 1 Thread 0x7f108a9b5760 (LWP 3094)  0x00007f1089c0093d in read ()
   from /lib/libpthread.so.0

Thread 3 (Thread 0x7f1089657710 (LWP 3095)):
#0  0x00007f1089bfd85c in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/libpthread.so.0
#1  0x00000000005ea4dc in GC_wait_marker () at pthread_support.c:1787
#2  0x00000000005f5802 in GC_help_marker (my_mark_no=2) at mark.c:1116
#3  0x00000000005e91b8 in GC_mark_thread (id=0x0) at pthread_support.c:548
#4  0x00007f1089bf89ca in start_thread () from /lib/libpthread.so.0
#5  0x00007f108973e6fd in clone () from /lib/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f1087ca8710 (LWP 3096)):
#0  0x00007f1089bffb50 in sem_wait () from /lib/libpthread.so.0
#1  0x00000000005d35b8 in mono_sem_wait (sem=0x11c1760, alertable=0)
    at mono-semaphore.c:102
#2  0x00000000005525e2 in finalizer_thread (unused=<value optimized out>)
    at gc.c:1048
#3  0x000000000055cbff in start_wrapper (data=<value optimized out>)
    at threads.c:744
#4  0x00000000005ba044 in thread_start_routine (args=0x27c38d0)
    at wthreads.c:285
#5  0x00000000005ea13f in GC_start_routine (arg=0x7f108a813fc0)
    at pthread_support.c:1392
#6  0x00007f1089bf89ca in start_thread () from /lib/libpthread.so.0
#7  0x00007f108973e6fd in clone () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f108a9b5760 (LWP 3094)):
#0  0x00007f1089c0093d in read () from /lib/libpthread.so.0
#1  0x0000000000492457 in read (signal=<value optimized out>, 
    ctx=<value optimized out>) at /usr/include/bits/unistd.h:45
#2  mono_handle_native_sigsegv (signal=<value optimized out>, 
    ctx=<value optimized out>) at mini-exceptions.c:1935
#3  <signal handler called>
#4  0x00007f108968ba75 in raise () from /lib/libc.so.6
#5  0x00007f108968f5c0 in abort () from /lib/libc.so.6
#6  0x00007f1089684941 in __assert_fail () from /lib/libc.so.6
#7  0x0000000000bd675d in
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, llvm::Twine const&, llvm::Instruction*) ()
#8  0x0000000000b9db95 in LLVMBuildAdd ()
#9  0x00000000004c74c7 in process_bb (cfg=<value optimized out>)
    at mini-llvm.c:2771
#10 mono_llvm_emit_method (cfg=<value optimized out>) at mini-llvm.c:4000
#11 0x0000000000420f2a in mini_method_compile (method=
    "MonoBugTest.Program:Main ()", opts=<value optimized out>, 
    domain=<value optimized out>, run_cctors=<value optimized out>, 
    compile_aot=<value optimized out>, parts=<value optimized out>)
    at mini.c:4550
#12 0x0000000000422d2f in mono_jit_compile_method_inner (method=
    "MonoBugTest.Program:Main ()", opt=51472895, ex=0x7fffa1fc00a8)
    at mini.c:4835
#13 mono_jit_compile_method_with_opt (method="MonoBugTest.Program:Main ()", 
    opt=51472895, ex=0x7fffa1fc00a8) at mini.c:5043
#14 0x0000000000423929 in mono_jit_runtime_invoke (method=
    "MonoBugTest.Program:Main ()", obj=0x0, params=<value optimized out>, exc=
    0x0) at mini.c:5241
#15 0x000000000058ebcb in mono_runtime_invoke (method=
    "MonoBugTest.Program:Main ()", obj=0x0, params=0x7fffa1fc0240, exc=0x0)
    at object.c:2709
#16 0x0000000000592463 in mono_runtime_exec_main (method=
    "MonoBugTest.Program:Main ()", args=<value optimized out>, exc=0x0)
    at object.c:3846
#17 0x000000000047189f in main_thread_handler (argc=<value optimized out>, 
    argv=<value optimized out>) at driver.c:999
#18 mono_main (argc=<value optimized out>, argv=<value optimized out>)
    at driver.c:1830
#19 0x00007f1089676c4d in __libc_start_main () from /lib/libc.so.6
#20 0x0000000000418939 in _start ()

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.

More information about the mono-bugs mailing list