This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Fix varargs function that call recover
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Thu, 01 Mar 2012 09:11:57 -0800
- Subject: Go patch committed: Fix varargs function that call recover
- Authentication-results: mr.google.com; spf=pass (google.com: domain of iant@google.com designates 10.68.134.168 as permitted sender) smtp.mail=iant@google.com; dkim=pass header.i=iant@google.com
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());
+}