[Mono-bugs] [Bug 694318] New: Simple method with two out datetimes generates code that crashes mono

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 17 11:40:57 EDT 2011


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

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


           Summary: Simple method with two out datetimes generates code
                    that crashes mono
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: i386
        OS/Version: Kubuntu
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: psonek2 at seznam.cz
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development
           Blocker: No


Description of Problem:

This is the program:

using System;

namespace DateTimeTest
{
    class MainClass
    {
        public static void GetValidity(
            out DateTime dtA, out DateTime dtB
            )
        {
            dtA = dtB = new DateTime();
        }

        public static void Main (string[] args)
        {
            DateTime dtA, dtB;
            GetValidity(out dtA, out dtB);
        }
    }
}

The method GetValidity is probably generated wrong:

    IL_0000:  ldarg.0 
    IL_0001:  ldarg.1 
    IL_0002:  initobj [mscorlib]System.DateTime
    IL_0008:  ldarg.1 
    IL_0009:  stobj [mscorlib]System.DateTime
    IL_000e:  ret 

To me it looks like the stobj instruction rewrites contents of stack.

It can be easily workarounded if you modify it e.g. to:

dtA = dtB = DateTime.MinValue;


Steps to reproduce the problem:
Download and unpack attached monodevelop project and do:

mono DateTimeTest.exe

Actual Results:

radek at rp-core:~/Projects/DateTimeTest/DateTimeTest/bin/Debug$ mono
DateTimeTest.exe 
**
ERROR:method-to-ir.c:11047:mono_spill_global_vars: assertion failed:
(store_opcode != OP_STOREV_MEMBASE)
Stacktrace:


Native stacktrace:

        mono() [0x80dbc5b]
        [0xf77d2410]
        /lib/i386-linux-gnu/libc.so.6(abort+0x17e) [0xf756334e]
        /lib/i386-linux-gnu/libglib-2.0.so.0(g_assertion_message+0x150)
[0xf774b3a0]
        /lib/i386-linux-gnu/libglib-2.0.so.0(+0x6897d) [0xf774b97d]
        mono() [0x809e452]
        mono() [0x806145b]
        mono() [0x8061f42]
        mono() [0x8062d68]
        mono(mono_runtime_invoke+0x3e) [0x8192eee]
        mono(mono_runtime_exec_main+0xe0) [0x81959e0]
        mono(mono_runtime_run_main+0x11d) [0x8195ced]
        mono(mono_main+0x1676) [0x80b7706]
        mono() [0x8059355]
        /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0xf754be37]
        mono() [0x8059291]

Debug info from gdb:

[Thread debugging using libthread_db enabled]
[New Thread 0xf345cb70 (LWP 8749)]
[New Thread 0xf42bcb70 (LWP 8748)]
[New Thread 0xf4abdb70 (LWP 8747)]
[New Thread 0xf52beb70 (LWP 8746)]
[New Thread 0xf5abfb70 (LWP 8745)]
[New Thread 0xf62c0b70 (LWP 8744)]
[New Thread 0xf6ac1b70 (LWP 8743)]
[New Thread 0xf72c2b70 (LWP 8742)]
0xf77d2430 in __kernel_vsyscall ()
  9 Thread 0xf72c2b70 (LWP 8742)  0xf77d2430 in __kernel_vsyscall ()
  8 Thread 0xf6ac1b70 (LWP 8743)  0xf77d2430 in __kernel_vsyscall ()
  7 Thread 0xf62c0b70 (LWP 8744)  0xf77d2430 in __kernel_vsyscall ()
  6 Thread 0xf5abfb70 (LWP 8745)  0xf77d2430 in __kernel_vsyscall ()
  5 Thread 0xf52beb70 (LWP 8746)  0xf77d2430 in __kernel_vsyscall ()
  4 Thread 0xf4abdb70 (LWP 8747)  0xf77d2430 in __kernel_vsyscall ()
  3 Thread 0xf42bcb70 (LWP 8748)  0xf77d2430 in __kernel_vsyscall ()
  2 Thread 0xf345cb70 (LWP 8749)  0xf77d2430 in __kernel_vsyscall ()
* 1 Thread 0xf74f4900 (LWP 8741)  0xf77d2430 in __kernel_vsyscall ()

Thread 9 (Thread 0xf72c2b70 (LWP 8742)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 8 (Thread 0xf6ac1b70 (LWP 8743)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 7 (Thread 0xf62c0b70 (LWP 8744)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 6 (Thread 0xf5abfb70 (LWP 8745)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 5 (Thread 0xf52beb70 (LWP 8746)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 4 (Thread 0xf4abdb70 (LWP 8747)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 3 (Thread 0xf42bcb70 (LWP 8748)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c648c in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x0821258a in ?? ()
#3  0x0820b1a9 in ?? ()
#4  0x08210db2 in ?? ()
#5  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 2 (Thread 0xf345cb70 (LWP 8749)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c87d5 in sem_wait@@GLIBC_2.1 () from
/lib/i386-linux-gnu/libpthread.so.0
#2  0x08200488 in mono_sem_wait ()
#3  0x081412d8 in ?? ()
#4  0x081c3da4 in ?? ()
#5  0x081f669a in ?? ()
#6  0x08211c12 in ?? ()
#7  0xf76c1e99 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#8  0xf760573e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 1 (Thread 0xf74f4900 (LWP 8741)):
#0  0xf77d2430 in __kernel_vsyscall ()
#1  0xf76c952b in read () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x080dbe3d in ?? ()
#3  <signal handler called>
#4  0xf77d2430 in __kernel_vsyscall ()
#5  0xf755fe71 in raise () from /lib/i386-linux-gnu/libc.so.6
#6  0xf756334e in abort () from /lib/i386-linux-gnu/libc.so.6
#7  0xf774b3a0 in g_assertion_message () from
/lib/i386-linux-gnu/libglib-2.0.so.0
#8  0xf774b97d in g_assertion_message_expr () from
/lib/i386-linux-gnu/libglib-2.0.so.0
#9  0x0809e452 in ?? ()
#10 0x0806145b in ?? ()
#11 0x08061f42 in ?? ()
#12 0x08062d68 in ?? ()
#13 0x08192eee in mono_runtime_invoke ()
#14 0x081959e0 in mono_runtime_exec_main ()
#15 0x08195ced in mono_runtime_run_main ()
#16 0x080b7706 in mono_main ()
#17 0x08059355 in ?? ()
#18 0xf754be37 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#19 0x08059291 in ?? ()

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

Aborted

Expected Results:

Program just runs and ends up.


How often does this happen? 

Always


Additional Information:

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