https://bugzilla.novell.com/show_bug.cgi?id=640709
https://bugzilla.novell.com/show_bug.cgi?id=640709#c0 Summary: Mono 2.8 Preview 6: gmcs regression -- compiler crash when emitting iterators Classification: Mono Product: Mono: Compilers Version: 2.8.x Platform: Macintosh OS/Version: Mac OS X 10.6 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.25 Safari/534.3 This code compiles successfully using 2.6.7. It also compiles successfully (and emits warning CS1911) when compiled using microsoft's toolchain. The 2.8 compiler crashes, however. I was testing using the x86 binary installer for osx from http://mono.ximian.com/monobuild/preview/download-preview/ At the time of the download top of the webpage at that URL indicated the following version: Mono 2.8 Downloads (Preview 6 [58f029f]) Code to reproduce: br...@brianmbp ~ $ cat x.cs using System.Collections.Generic; namespace Test { public abstract class Base { public virtual IEnumerable<Base> GetStuff(int a) { yield return this; } } public abstract class Derived : Base { public override IEnumerable<Base> GetStuff(int a) { foreach (var x in base.GetStuff(a)) yield return x; } } public class SpecialDerived : Derived { public override IEnumerable<Base> GetStuff(int a) { foreach (var x in base.GetStuff(a)) yield return x; } public static void Main(string[] args) { } } } br...@brianmbp ~ $ gmcs --version Mono C# compiler version 2.8.0.0 br...@brianmbp ~ $ gmcs x.cs Internal compiler error at Internal(1,1):: exception caught while emitting MethodBuilder [SpecialDerived::<GetStuff>__BaseCallProxy0] Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator. at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode, System.Reflection.Emit.LocalBuilder local) [0x00000] in <filename unknown>:0 at Mono.CSharp.EmitContext.Emit (OpCode opcode, System.Reflection.Emit.LocalBuilder local) [0x00000] in <filename unknown>:0 at Mono.CSharp.LocalTemporary.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.MemberExpr.EmitInstance (Mono.CSharp.EmitContext ec, Boolean prepare_for_load) [0x00000] in <filename unknown>:0 at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0 at Mono.CSharp.HoistedVariable.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0 at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0 at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Arguments.Emit (Mono.CSharp.EmitContext ec, Boolean dup_args, Mono.CSharp.LocalTemporary this_arg) [0x00000] in <filename unknown>:0 at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0 at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Arguments arguments) [0x00000] in <filename unknown>:0 at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Return.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] in <filename unknown>:0 at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 Reproducible: Always Steps to Reproduce: See above Actual Results: Compiler crashes Expected Results: Successful compilation A few interesting things that I found while trying to make the test case as minimal as possible: 1. If I move the base.GetStuff(a) calls out to separate methods, the crash goes away. 2. Two levels of inheritance seem to be required to reproduce the bug. 3. The GetStuff() method must have arguments in order for the crash to manifest. Also, thanks for adding the "Internal compiler error at Internal(1,1):: exception caught while emitting MethodBuilder [SpecialDerived::<GetStuff>__BaseCallProxy0]" information. It saved me dozens of minutes that I would have had to spend otherwise to narrow down where the crash was being triggered if I were debugging a previous version of the compiler. -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
