aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-02-10 23:58:36 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-02-10 23:58:36 +0000
commitc7f4431d458f91429b636ec22d80ce5db1cdd1f8 (patch)
treef50219d45d26ff74eb15e450ec50f1f888fb3b3e
parent4a299bf4ff32f153cf07e684e177a97568325708 (diff)
downloadgcc-c7f4431d458f91429b636ec22d80ce5db1cdd1f8.zip
gcc-c7f4431d458f91429b636ec22d80ce5db1cdd1f8.tar.gz
gcc-c7f4431d458f91429b636ec22d80ce5db1cdd1f8.tar.bz2
Don't crash on erroneous thunk.
From-SVN: r170031
-rw-r--r--gcc/go/gofrontend/statements.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index c0efc2d..6b45d01 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())
{