Go patch committed: Fix named results and recover

Message ID mcr7hf2k3d7.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Dec. 22, 2010, 1:23 a.m.
The code which handled functions with named results which called recover
was buggy.  It assumed that the named results for the cloned function
would be the same, but in fact each function has its own individual list
of result variables.  This patch fixes the problem.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.



diff -r 686314607209 go/gogo.cc
--- a/go/gogo.cc	Tue Dec 21 17:13:42 2010 -0800
+++ b/go/gogo.cc	Tue Dec 21 17:19:03 2010 -0800
@@ -2628,7 +2628,7 @@ 
 Function::swap_for_recover(Function *x)
   gcc_assert(this->enclosing_ == x->enclosing_);
-  gcc_assert(this->named_results_ == x->named_results_);
+  std::swap(this->named_results_, x->named_results_);
   std::swap(this->closure_var_, x->closure_var_);
   std::swap(this->block_, x->block_);
   gcc_assert(this->location_ == x->location_);