[Mono-bugs] [Bug 78786][Nor] Changed - Unreachability in anonymous method causes compiler crash.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 18 18:09:22 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 miguel at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78786

--- shadow/78786	2006-07-07 06:18:22.000000000 -0400
+++ shadow/78786.tmp.18649	2006-07-18 18:09:22.000000000 -0400
@@ -10,14 +10,13 @@
 Component: C#
 AssignedTo: rharinath at novell.com                            
 ReportedBy: ohh at scisoft.dk               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
-Summary: Compiler crash on anonymous methods stored in Dictionary.
+Summary: Unreachability in anonymous method causes compiler crash.
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 There seems to be a bug when compiling methods containing definitions of
 anonymous methods. When declaring a delegate and storing the value into a
@@ -92,6 +91,38 @@
                 System.Console.WriteLine (dict["a"] (2));
         }
 }
 
 So temporarily storing the delegate into a local variable is a work
 around.
+
+------- Additional Comments From miguel at ximian.com  2006-07-18 18:09 -------
+I tracked the problem down to a reachability issue.
+
+the problem is that "return" statement is determined to be
+"unreachable", which triggers the replacement of the statements with
+an EmptyStatement (happens in statement.cs, Block.Resolve).   This is
+the code in question:
+
+if (unreachable && !(s is LabeledStatement) && !(s is Block)){
+	statements [ix] = EmptyStatement.Value;
+}
+
+In fact, the warning should have been a hint of the problem.
+
+Still the root of the cause is that the code is incorrectly flagged as
+unreachable, this happens in codegen.cs in line 701:
+
+       if (reachability.IsUnreachable)
+                  unreachable = true;
+
+Which seems wrong, as this is the only statement in this block. Maybe
+the issue is related to the way the "current_flow_branching" is
+assigned a few lines before:
+
+if(anonymous_method_host != null)
+	current_flow_branching = new FlowBranchingToplevel 
+                      (anonymous_method_host.CurrentBranching, block);
+else 
+	current_flow_branching = block.TopLevelBranching;
+
+Miguel.


More information about the mono-bugs mailing list