diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index c0efc2dca4f88efaf9da563f56653f5a9a0a528f..6b45d0111e02c438c97b48dbf2bf6e82e5154dcb 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -1776,8 +1776,13 @@ Thunk_statement::do_determine_types() // Now that we know the types of the call, build the struct used to // pass parameters. - Function_type* fntype = - this->call_->call_expression()->get_function_type(); + Call_expression* ce = this->call_->call_expression(); + if (ce == NULL) + { + gcc_assert(this->call_->is_error_expression()); + return; + } + Function_type* fntype = ce->get_function_type(); if (fntype != NULL && !this->is_simple(fntype)) this->struct_type_ = this->build_struct(fntype); } @@ -1788,6 +1793,11 @@ void Thunk_statement::do_check_types(Gogo*) { Call_expression* ce = this->call_->call_expression(); + if (ce == NULL) + { + gcc_assert(this->call_->is_error_expression()); + return; + } Function_type* fntype = ce->get_function_type(); if (fntype != NULL && fntype->is_method()) {