[Mono-bugs] [Bug 73260][Nor] New - Syntax error causes gmcs to crash

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 3 Mar 2005 02:34:12 -0500 (EST)

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 dsilva@ccs.neu.edu.


--- shadow/73260	2005-03-03 02:34:12.000000000 -0500
+++ shadow/73260.tmp.14017	2005-03-03 02:34:12.000000000 -0500
@@ -0,0 +1,83 @@
+Bug#: 73260
+Product: Mono: Compilers
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dsilva@ccs.neu.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Syntax error causes gmcs to crash
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Steps to reproduce the problem:
+1. Put this in a file:
+public class Foo {
+  delegate Inner foo_fn(string s);
+  public static void Main(string[] args) {
+    foo_fn f = delegate (string s) {
+     int len = s.Length;
+     return new Inner(s + s); };
+    f(args[0]);
+  }
+  class Inner { public Inner(string s) {} }
+2. Compile it with gmcs
+Actual Results:
+$ gmcs Foo.cs
+Foo.cs(7) warning CS0219: The variable 'len' is assigned but its value is
+never used
+Foo.cs(6) error CS0050: Inconsistent accessibility: return type `Foo.Inner'
+is less accessible than method `<#AnonymousMethod>0'
+Foo.cs(12): 'Foo.Inner' (name of symbol related to previous error
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0000d> Mono.CSharp.AnonymousMethod:GetMethodBuilder ()
+in <0x000b0> Mono.CSharp.AnonymousDelegate:Emit (Mono.CSharp.EmitContext)
+in <0x0003e> Mono.CSharp.LocalVariableReference:EmitAssign
+in <0x00173> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext,bool)
+in <0x00012> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext)
+in <0x00011> Mono.CSharp.StatementExpression:DoEmit (Mono.CSharp.EmitContext)
+in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext)
+in <0x000a2> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext)
+in <0x00245> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext)
+in <0x0001a> Mono.CSharp.EmitContext:EmitResolvedTopBlock
+in <0x0005f> Mono.CSharp.EmitContext:EmitTopBlock
+in <0x0037a> Mono.CSharp.MethodData:Emit
+in <0x00022> Mono.CSharp.Method:Emit ()
+in <0x00595> Mono.CSharp.TypeContainer:EmitType ()
+in <0x003f8> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c06> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0001f> Mono.CSharp.Driver:Main (string[])
+Expected Results:
+Just the syntax error.
+How often does this happen? 
+Whenever a delegate's return type is an inner class.