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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=76914 --- shadow/76914 2005-12-05 07:21:47.000000000 -0500 +++ shadow/76914.tmp.21702 2005-12-05 07:21:47.000000000 -0500 @@ -0,0 +1,176 @@ +Bug#: 76914 +Product: Mono: Compilers +Version: 1.1 +OS: Debian Woody +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: gmcs v.1.1.10-1 in the mono-gmcs package crashes + +Please fill in this template when reporting a bug, unless you know what you +are doing. +Description of Problem: +I got a very strange exception when compiling my sourcecode. + +Steps to reproduce the problem: +1. Run this on the commandline: + gmcs Board.cs + +--- The output --- + +Exception caught by the compiler while compiling: + Block that caused the problem begin at: Board.cs(78,18): + Block being compiled: +[Board.cs(80,46):,Board.cs(82,13):] +System.NullReferenceException: Object reference not set to an instance of +an object + +Unhandled Exception: System.NullReferenceException: Object reference not +set to an instance of an object +in <0x00014> Mono.CSharp.EmptyCast:.ctor (Mono.CSharp.Expression child, +System.Type return_type) +in <0x0020e> Mono.CSharp.Convert:ExplicitConversionCore +(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, + System.Type target_type, Location loc) +in <0x00016> Mono.CSharp.Convert:ExplicitConversion +(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, Sys +tem.Type target_type, Location loc) +in <0x00179> Mono.CSharp.Cast:ResolveRest (Mono.CSharp.EmitContext ec) +in <0x0003c> Mono.CSharp.Cast:DoResolve (Mono.CSharp.EmitContext ec) +in <0x000e3> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec, +ResolveFlags flags) +in <0x00012> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec) +in <0x00164> Mono.CSharp.Return:Resolve (Mono.CSharp.EmitContext ec) +in <0x001bd> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec) +in <0x001fe> Mono.CSharp.If:Resolve (Mono.CSharp.EmitContext ec) +in <0x001bd> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec) +in <0x000a6> Mono.CSharp.Foreach+CollectionForeachStatement:Resolve +(Mono.CSharp.EmitContext ec) +in <0x0010c> Mono.CSharp.While:Resolve (Mono.CSharp.EmitContext ec) +in <0x0026e> Mono.CSharp.Foreach+CollectionForeach:Resolve +(Mono.CSharp.EmitContext ec) +in <0x00257> Mono.CSharp.Foreach:Resolve (Mono.CSharp.EmitContext ec) +in <0x001bd> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec) +in <0x001bd> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec) +in <0x00122> Mono.CSharp.EmitContext:ResolveTopBlock +(Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp. +ToplevelBlock block, Mono.CSharp.InternalParameters ip, IMethodData md, +System.Boolean unreachable) + +shell returned 1 + +-- The source of Board.cs --- + +using System; +using System.Collections; + +public class Position { + + public int x; + public int y; + + public Position(int x, int y) { + this.x = x; + this.y = y; + } + + public Position(Position p) { + this.x = p.x; + this.y = p.y; + } + + public int ToX() { +return x; + } + + public int ToY() { +return y; + } + + public override string ToString() { +return "pos: (" + x.ToString() + ", " + y.ToString() + ")"; + } + +} + +public class Board { + + private Hashtable board; + private int boardsize; + + public enum Stone : int { +None = 0, +Empty = 1, +Black = 2, +White = 3 + } + + public int size { + get { + return boardsize; + } + } + public int width { + get { + return boardsize; + } + } + public int height { + get { + return boardsize; + } + } + + public Board(int size) { +boardsize = size; + board = new Hashtable(); + } + + public void Set(Position p, Stone s) { + board.Add(p, s); + } + + public Stone Get(Position p) { + if (board.Contains(p)) { + return (Stone)board[p]; + } else { + return Stone.None; + } + } + + public Stone Get(int x, int y) { + foreach (Position p in board.Keys) { + if ((p.x == x) && (p.y == y)) { + return (Stone)p; + } + } + return Stone.None; + } + + public string GetID() { + string s = ""; + for (int y=0; y < height; y++) { + for (int x=0; x < width; x++) { + Stone stone = Get(x, y); + if (stone != NoStone) { + s += ((int)stone).ToString(); + } + } + } + return s; + } + + public static void Main() { + Board b = new Board(9); + } + +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
