[Mono-bugs] [Bug 79147][Maj] New - [GMCS] Compiling nested anonymous delegate accessing 'this' fails
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Aug 22 21:36:30 EDT 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by horst.reiterer at mind-breeze.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79147
--- shadow/79147 2006-08-22 21:36:30.000000000 -0400
+++ shadow/79147.tmp.5695 2006-08-22 21:36:30.000000000 -0400
@@ -0,0 +1,106 @@
+Bug#: 79147
+Product: Mono: Compilers
+Version: 1.1
+OS: other
+OS Details: Red Hat Enterprise Linux 4 Update 2
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: horst.reiterer at mind-breeze.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [GMCS] Compiling nested anonymous delegate accessing 'this' fails
+
+Compiling the following testcase succeeds with csc but fails with gmcs
+(1.1.13.6):
+
+ public delegate void A();
+
+ class B
+ {
+ void C()
+ {
+ A a = delegate {
+ A b = delegate {
+ B c = this;
+ };
+ };
+ }
+
+ static void Main()
+ {
+ B b = new B();
+ b.C();
+ }
+ }
+
+Steps to reproduce the problem:
+1. gmcs testcase.cs
+
+Actual Results:
+
+Unhandled Exception: System.Exception: Trying to emit a local from a
+different ILGenerator.
+in <0x005e7> System.Reflection.Emit.ILGenerator:Emit (OpCode opcode,
+System.Reflection.Emit.LocalBuilder lbuilder)
+in <0x00072> Mono.CSharp.ScopeInfo:EmitScopeInstance
+(System.Reflection.Emit.ILGenerator ig)
+in <0x0008a> Mono.CSharp.CaptureContext:EmitMethodHostInstance
+(Mono.CSharp.EmitContext target, Mono.CSharp.AnonymousContainer am)
+in <0x0001f> Mono.CSharp.EmitContext:EmitMethodHostInstance
+(Mono.CSharp.EmitContext target, Mono.CSharp.AnonymousMethod am)
+in <0x0001c> Mono.CSharp.AnonymousDelegate+AnonymousInstance:Emit
+(Mono.CSharp.EmitContext ec)
+in <0x0005c> Mono.CSharp.DelegateCreation:Emit (Mono.CSharp.EmitContext ec)
+in <0x000c6> Mono.CSharp.AnonymousDelegate:Emit (Mono.CSharp.EmitContext ec)
+in <0x0003e> Mono.CSharp.LocalVariableReference:EmitAssign
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean
+leave_copy, Boolean prepare_for_load)
+in <0x0017f> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext ec, Boolean
+is_statement)
+in <0x0000f> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext ec)
+in <0x00011> Mono.CSharp.StatementExpression:DoEmit
+(Mono.CSharp.EmitContext ec)
+in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
+in <0x000a8> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x00268> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
+in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
+(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
+in <0x000a8> Mono.CSharp.AnonymousMethod:EmitMethod
+(Mono.CSharp.EmitContext ec)
+in <0x0001a> Mono.CSharp.AnonymousDelegate:Emit (Mono.CSharp.EmitContext ec)
+in <0x0003e> Mono.CSharp.LocalVariableReference:EmitAssign
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean
+leave_copy, Boolean prepare_for_load)
+in <0x0017f> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext ec, Boolean
+is_statement)
+in <0x0000f> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext ec)
+in <0x00011> Mono.CSharp.StatementExpression:DoEmit
+(Mono.CSharp.EmitContext ec)
+in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
+in <0x000a8> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x00268> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
+in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
+(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
+in <0x0007e> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
+Mono.CSharp.ToplevelBlock block)
+in <0x001c0> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
+container, Mono.CSharp.Attributable kind)
+in <0x00030> Mono.CSharp.Method:Emit ()
+in <0x0072d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00226> Mono.CSharp.RootContext:EmitCode ()
+in <0x00a9f> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x00051> Mono.CSharp.Driver:Main (System.String[] args)
+
+Expected Results:
+
+Successful compilation.
+
+How often does this happen?
+
+100 out of 100 times
More information about the mono-bugs
mailing list