aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/statements.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-12-04 05:17:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-12-04 05:17:54 +0000
commit3f7af571aa8bcd3707843c413b2baa06bbe46ff3 (patch)
treefc45f7b721523284e00758f9174c0e8d2878b20d /gcc/go/gofrontend/statements.cc
parent114d8843e607fd4856c2a35741a80cddb965f278 (diff)
downloadgcc-3f7af571aa8bcd3707843c413b2baa06bbe46ff3.zip
gcc-3f7af571aa8bcd3707843c413b2baa06bbe46ff3.tar.gz
gcc-3f7af571aa8bcd3707843c413b2baa06bbe46ff3.tar.bz2
compiler: Fix crash in go/defer of some builtin functions.
From-SVN: r194114
Diffstat (limited to 'gcc/go/gofrontend/statements.cc')
-rw-r--r--gcc/go/gofrontend/statements.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index ad249f6..fb1322f 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -2006,6 +2006,8 @@ Thunk_statement::do_determine_types()
void
Thunk_statement::do_check_types(Gogo*)
{
+ if (!this->call_->discarding_value())
+ return;
Call_expression* ce = this->call_->call_expression();
if (ce == NULL)
{
@@ -2471,11 +2473,15 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
Expression_statement* es =
static_cast<Expression_statement*>(call_statement);
Call_expression* ce = es->expr()->call_expression();
- go_assert(ce != NULL);
- if (may_call_recover)
- ce->set_is_deferred();
- if (recover_arg != NULL)
- ce->set_recover_arg(recover_arg);
+ if (ce == NULL)
+ go_assert(saw_errors());
+ else
+ {
+ if (may_call_recover)
+ ce->set_is_deferred();
+ if (recover_arg != NULL)
+ ce->set_recover_arg(recover_arg);
+ }
}
// That is all the thunk has to do.