The Go frontend mishandled varargs functions that call recover. This patch fixes that. The patch also fixes a couple of other cases where the compiler crashed on invalid input. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 0927d16a6df2 go/expressions.h --- a/go/expressions.h Wed Feb 29 21:59:00 2012 -0800 +++ b/go/expressions.h Thu Mar 01 09:10:10 2012 -0800 @@ -1066,6 +1066,10 @@ { return this->expr_; } protected: + int + do_traverse(Traverse* traverse) + { return Expression::traverse(&this->expr_, traverse); } + Type* do_type(); diff -r 0927d16a6df2 go/gogo.cc --- a/go/gogo.cc Wed Feb 29 21:59:00 2012 -0800 +++ b/go/gogo.cc Thu Mar 01 09:10:10 2012 -0800 @@ -2500,6 +2500,9 @@ Call_expression* call = Expression::make_call(fn, args, false, location); + // Any varargs call has already been lowered. + call->set_varargs_are_lowered(); + Statement* s; if (orig_fntype->results() == NULL || orig_fntype->results()->empty()) s = Statement::make_statement(call, true); @@ -5346,5 +5349,5 @@ else if (this->var_ != NULL) this->var_->add_preinit_statement(this->gogo_, s); else - go_unreachable(); -} + go_assert(saw_errors()); +}