[Mono-bugs] [Bug 381559] New: trivially simple reproduction of Invalid IL code bug ( anonymous methods + string concat)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 18 17:42:36 EDT 2008


           Summary: trivially simple reproduction of Invalid IL code bug
                    (anonymous methods + string concat)
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: danny at sooloos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

% cat foo.cs
using System;
using System.Threading;

class Fail {
    static void Main() {
        string a = "";
        a += "A" + 1 + "B" + 2;
        EventHandler t = delegate { Console.WriteLine(a); };

% gmcs foo.cs
foo.cs(8,22): warning CS0219: The variable `t' is assigned but its value is
never used
Compilation succeeded - 1 warning(s)

% mono foo.exe 
Unhandled Exception: System.InvalidProgramException: Invalid IL code in
Fail:Main (): IL_0023: ldfld     0x04000001

% mono -V
Mono JIT compiler version 1.9 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  x86
        Disabled:      none

the IL:

method private hidebysig static void  Main() cil managed
  // Code size       99 (0x63)
  .maxstack  6
  .locals init (class Fail/'<>c__CompilerGenerated0' V_0,
           class [mscorlib]System.EventHandler V_1)
  IL_0000:  nop
  IL_0001:  ldc.i4     0x1
  IL_0006:  pop
  IL_0007:  nop
  IL_0008:  newobj     instance void Fail/'<>c__CompilerGenerated0'::.ctor()
  IL_000d:  stloc.0
  IL_000e:  ldloc.0
  IL_000f:  ldstr      ""
  IL_0014:  stfld      string Fail/'<>c__CompilerGenerated0'::'<1:a>'
  IL_0019:  ldloc.0
  IL_001a:  dup
  IL_001b:  ldc.i4.5
  IL_001c:  newarr     [mscorlib]System.Object
  IL_0021:  dup
  IL_0022:  ldc.i4.0
missing object load here!
  IL_0023:  ldfld      string Fail/'<>c__CompilerGenerated0'::'<1:a>'
  IL_0028:  stelem.ref
  IL_0029:  dup
  IL_002a:  ldc.i4.1
  IL_002b:  ldstr      "A"
  IL_0030:  stelem.ref
  IL_0031:  dup
  IL_0032:  ldc.i4.2
  IL_0033:  ldc.i4.1
  IL_0034:  box        [mscorlib]System.Int32
  IL_0039:  stelem.ref
  IL_003a:  dup
  IL_003b:  ldc.i4.3
  IL_003c:  ldstr      "B"
  IL_0041:  stelem.ref
  IL_0042:  dup
  IL_0043:  ldc.i4.4
  IL_0044:  ldc.i4.2
  IL_0045:  box        [mscorlib]System.Int32
  IL_004a:  stelem.ref
  IL_004b:  call       string [mscorlib]System.String::Concat(object[])
  IL_0050:  stfld      string Fail/'<>c__CompilerGenerated0'::'<1:a>'
  IL_0055:  ldloc.0
  IL_0056:  ldftn      instance void
  class [mscorlib]System.EventArgs)
  IL_005c:  newobj     instance void
native int)
  IL_0061:  stloc.1
  IL_0062:  ret
} // end of method Fail::Main

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