[Mono-bugs] [Bug 418312] New: gmcs crashes with complex lambda expressions

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 19 09:21:26 EDT 2008


           Summary: gmcs crashes with complex lambda expressions
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jbevain at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


using System;
using System.Linq;
using System.Collections.Generic;

static class CurryBug
{       // curry for function of arity 3
        // this compiles
        public static Func<int,Func<int, Func<int,int>>>
                curry_for_int_func (this Func<int,int,int,int> f)
                return arg1 => arg2 => arg3 => f(arg1 , arg2 , arg3);

        // but his does not
        static Func<A,Func<B,Func<C,D>>> curry<A,B,C,D> (this Func<A,B,C,D> f)
                return arg1 => arg2 => arg3 => f(arg1, arg2, arg3);

        static void Main ()
                Func<int,int,int,int> plus = (x, y, z) => x + y + z;


Compiles with csc and outputs 77.


[mono] ~/Desktop @ gmcs curry_bug.cs 
Exception caught by the compiler while emitting:
   Block that caused the problem begin at: curry_bug.cs(12,40):
System.Exception: Trying to emit a local from a different ILGenerator.
Internal compiler error at curry_bug.cs(12,37):: exception caught while
emitting MethodBuilder [<curry_for_int_func>c__AnonStorey1::<>m__3]

Unhandled Exception: System.Exception: Trying to emit a local from a different
  at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode,
System.Reflection.Emit.LocalBuilder local) [0x00000] 
  at Mono.CSharp.LocalTemporary.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.FieldExpr.EmitAssign (Mono.CSharp.EmitContext ec,
Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load)
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement)
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.AnonymousMethodStorey.EmitHoistedFieldsInitialization
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.AnonymousMethodStorey.EmitHoistedVariables
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.EmitContext.EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock
block, Boolean unreachable) [0x00000] 
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block) [0x00000]

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