Mono Runtime crashes when trying to emit opcode

Bug #755373 reported by Dylan Borg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dylan.NET
Fix Released
Critical
Dylan Borg
dylan.NET.Reflection
Fix Released
Critical
Dylan Borg
mono (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: mono-devel

When I tryy to use ILGenerator.Emit the Mono runtime fails saying there is an assertion fail in method-to-ir.c.

Here is a console extract:
dylan@ubuntu:/media/MOBEXTHDD/Code/dylannet$ mono ./compiler/dnc.exe
firstapp.txt
dylan.NET Compiler v. 11.2.4 for Microsoft (R) .NET Framework (R) v. 3.5 SP1
                           and Novell Mono v. 2.6.7 /v. 2.10
Copyright (C) Dylan Borg 2010
Now Lexing: firstapp.txt...Done.
Now Parsing: firstapp.txt...Done.
Referencing Assembly: compiler/mscorlib.dll
Referencing Assembly: compiler/System.dll
Referencing Assembly: compiler/System.Core.dll
Referencing Assembly: compiler/System.Data.dll
Referencing Assembly: compiler/System.Data.DataSetExtensions.dll
Referencing Assembly: compiler/System.Xml.dll
Referencing Assembly: compiler/System.Xml.Linq.dll
Referencing Assembly: compiler/System.Windows.Forms.dll
Referencing Assembly: compiler/Microsoft.VisualBasic.dll
Importing Namespace: Microsoft.VisualBasic
Importing Namespace: System
Importing Namespace: System.Reflection
Importing Namespace: System.Collections
Importing Namespace: System.Collections.Generic
Importing Namespace: System.Data
Importing Namespace: System.Diagnostics
Importing Namespace: System.Linq
Importing Namespace: System.Xml
Importing Namespace: System.Xml.Linq
Importing Namespace: System.Windows.Forms
Beginning Assembly: firstappg2
Adding Class: firstappg2.Module1
Adding Method: main
**
ERROR:method-to-ir.c:11047:mono_spill_global_vars: assertion failed:
(store_opcode != OP_STOREV_MEMBASE)
Stacktrace:

  at dylan.NET.Reflection.ILEmitter.EmitRet () <0xffffffff>
  at dylan.NET.Reflection.ILEmitter.EmitRet () <0x00017>
  at dylan.NET.Tokenizer.CodeGen.StmtReader.Read
(dylan.NET.Tokenizer.AST.Stmts.Stmt) <0x00cf8>
  at dylan.NET.Tokenizer.CodeGen.CodeGenerator.EmitMSIL
(dylan.NET.Tokenizer.AST.Stmts.StmtSet) <0x00082>
  at dylan.NET.Compiler.Module1.main (string[]) <0x00132>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0x00043>

Native stacktrace:

    mono() [0x80d4d0b]
    [0x44640c]
    /lib/libc.so.6(abort+0x182) [0x14ce42]
    /lib/libglib-2.0.so.0(g_assertion_message+0x15f) [0x7224af]
    /lib/libglib-2.0.so.0(+0x65aed) [0x722aed]
    mono() [0x806862b]
    mono() [0x8060088]
    mono() [0x80606bf]
    mono() [0x806123e]
    mono() [0x80d8b4e]
    [0x945066]
    [0x2d2341]
    [0x2d15ab]
    [0x33a2db]
    [0x33a384]
    mono() [0x8061328]
    mono(mono_runtime_invoke+0x40) [0x813c890]
    mono(mono_runtime_exec_main+0xde) [0x81403de]
    mono(mono_runtime_run_main+0x112) [0x81406e2]
    mono(mono_main+0x1679) [0x80b2f99]
    mono() [0x8059385]
    /lib/libc.so.6(__libc_start_main+0xe7) [0x135ce7]
    mono() [0x80592c1]

Debug info from gdb:

Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.

=================================================================
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
dylan@ubuntu:/media/MOBEXTHDD/Code/dylannet$

1.Using Ubuntu 10.10 Maverick Meerkat
2.Using mono-devel 2.6.7-3ubuntu1
3.I expected all opcodes to be emitted without crashes(all works fine on MS .NET)
4.The system crashed because of an assertion fail.

Tags: codegen dnr
Dylan Borg (borgdylan)
Changed in dylandotnet:
importance: Undecided → Critical
status: New → Confirmed
Changed in dnr:
status: New → Confirmed
importance: Undecided → Critical
Dylan Borg (borgdylan)
Changed in dylandotnet:
assignee: nobody → Dylan Borg (borgdylan)
Changed in dnr:
assignee: nobody → Dylan Borg (borgdylan)
Revision history for this message
Dylan Borg (borgdylan) wrote :

THe error was in the IL to be run.

Changed in mono (Ubuntu):
status: New → Invalid
Revision history for this message
Dylan Borg (borgdylan) wrote :

There was an error in InstructionHelper class.

Changed in dnr:
milestone: none → 11.2.5
status: Confirmed → Fix Committed
Changed in dylandotnet:
milestone: none → 11.2.5
status: Confirmed → Fix Committed
Dylan Borg (borgdylan)
Changed in dylandotnet:
status: Fix Committed → Fix Released
Changed in dnr:
status: Fix Committed → Fix Released
Dylan Borg (borgdylan)
tags: added: dnr
tags: added: codegen
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.