Fix #59427
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 3 May 2006 14:32:47 +0000 (14:32 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 3 May 2006 14:32:47 +0000 (14:32 -0000)
* mcs/flowanalysis.cs (FlowBranchingException.Merge): Ensure
control-flow passes through the 'finally' after merging-in all the
control-flows from 'try' and the 'catch' clauses.
* gmcs/flowanalysis.cs: Likewise.
* tests/test-505.cs: New test from #59427.

svn path=/trunk/mcs/; revision=60220

mcs/gmcs/ChangeLog
mcs/gmcs/flowanalysis.cs
mcs/mcs/ChangeLog
mcs/mcs/flowanalysis.cs
mcs/tests/ChangeLog
mcs/tests/test-505.cs [new file with mode: 0644]

index 2ec83506846d522b05ddd3edb2dfdf5201f9d3b7..d11475a361b7c7608cb1f9429a6106c87149dfcd 100644 (file)
@@ -1,5 +1,10 @@
 2006-05-03  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #59427
+       * flowanalysis.cs (FlowBranchingException.Merge): Ensure
+       control-flow passes through the 'finally' after merging-in all the
+       control-flows from 'try' and the 'catch' clauses.
+
        * flowanalysis.cs (FlowBranching.IsLoop): Remove.
        (FlowBranching.IsTryOrCatch): Remove 'is_return' parameter.  It's
        always true at the only non-recursive entry point.
index 4bce4f59f9e8ec0e7d3a0cd2ee5e68116b520ea7..32d3994cd97f8f7a200b692979674a7f38914944 100644 (file)
@@ -1325,6 +1325,10 @@ namespace Mono.CSharp
                {
                        UsageVector vector = Merge (catch_vectors);
 
+                       if (finally_vector != null)
+                               vector.MergeChild (finally_vector, false);
+
+                       // FIXME: this should probably go away.  I think it's harmless right now
                        vector.MergeFinally (finally_vector, finally_origins);
 
                        for (UsageVector origin = break_origins; origin != null; origin = origin.Next) {
index 618f962f4df9128167c28bc59b293d3a93cfd248..8a6c1d2f613831ca4c28712dfa88f13fbac5cf49 100644 (file)
@@ -1,5 +1,10 @@
 2006-05-03  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #59427
+       * flowanalysis.cs (FlowBranchingException.Merge): Ensure
+       control-flow passes through the 'finally' after merging-in all the
+       control-flows from 'try' and the 'catch' clauses.
+
        * flowanalysis.cs (FlowBranching.IsLoop): Remove.
        (FlowBranching.IsTryOrCatch): Remove 'is_return' parameter.  It's
        always true at the only non-recursive entry point.
index 8fc046536829b2f4dc1237d2af15f703dd237ddd..602302199abd97797c0257c87e5a52a66510ce9e 100644 (file)
@@ -1325,6 +1325,10 @@ namespace Mono.CSharp
                {
                        UsageVector vector = Merge (catch_vectors);
 
+                       if (finally_vector != null)
+                               vector.MergeChild (finally_vector, false);
+
+                       // FIXME: this should probably go away.  I think it's harmless right now
                        vector.MergeFinally (finally_vector, finally_origins);
 
                        for (UsageVector origin = break_origins; origin != null; origin = origin.Next) {
index 2b19d8b892c1c8f7acd00e28714f20816db6c3b9..a6a4690143ec6d32835ae39ddb3972aedaedd1bb 100644 (file)
@@ -1,5 +1,7 @@
 2006-05-03  Raja R Harinath  <rharinath@novell.com>
 
+       * test-505.cs: New test from #59427.
+
        * test-504.cs: New test from #76471.
 
        * test-503.cs: Distilled from System.Web.Hosting/ApplicationHost.cs.
diff --git a/mcs/tests/test-505.cs b/mcs/tests/test-505.cs
new file mode 100644 (file)
index 0000000..b6fc744
--- /dev/null
@@ -0,0 +1,19 @@
+class T {
+       public static int i;
+       static int f ()
+       {
+               try {
+               } finally {
+                       throw new System.Exception ("...");
+               }
+       }
+       static void Main ()
+       {
+               try {
+                       i = f ();
+               } catch {
+                       return;
+               }
+               throw new System.Exception ("error");
+       }
+}