[Mono-bugs] [Bug 73107][Wis] New - unreachable code in a conditional can cause mcs to crash
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 28 Feb 2005 04:05:02 -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 trow@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=73107
--- shadow/73107 2005-02-28 04:05:02.000000000 -0500
+++ shadow/73107.tmp.11461 2005-02-28 04:05:02.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 73107
+Product: Mono: Compilers
+Version: 1.1
+OS: NLD 9
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: trow@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: unreachable code in a conditional can cause mcs to crash
+
+Compiling
+
+class Foo {
+ static void Main ()
+ {
+ if (false) {
+ Foo foo = null;
+ if (foo != null) { }
+ }
+ }
+}
+
+with mcs 1.1.4.0 on NLD9 produces the following:
+
+% mcs --debug foo.cs
+bar.cs(4) warning CS0162: Unreachable code detected
+bar.cs(6) error CS0165: Use of unassigned local variable `foo'
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00023> Mono.CSharp.Expression:ResolveBoolean
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression,Mono.CSharp.Location)
+in <0x00027> Mono.CSharp.If:Resolve (Mono.CSharp.EmitContext)
+in <0x00191> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext)
+in <0x0008d> Mono.CSharp.Block:ResolveUnreachable
+(Mono.CSharp.EmitContext,bool)
+in <0x00166> Mono.CSharp.If:Resolve (Mono.CSharp.EmitContext)
+in <0x00191> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext)
+in <0x000fe> Mono.CSharp.EmitContext:ResolveTopBlock
+(Mono.CSharp.EmitContext,Mono.CSharp.ToplevelBlock,Mono.CSharp.InternalParameters,Mono.CSharp.Location,bool&)
+in <0x00030> Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.ToplevelBlock,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x0037a> Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Attributable)
+in <0x00022> Mono.CSharp.Method:Emit ()
+in <0x0057a> Mono.CSharp.TypeContainer:EmitType ()
+in <0x003e5> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c48> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])