This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

go patch committed: Don't crash on erroneous thunk


This patch to the Go compiler avoids a crash on an erroneous thunk.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r a9fb713eecf6 go/statements.cc
--- a/go/statements.cc	Thu Feb 10 15:41:00 2011 -0800
+++ b/go/statements.cc	Thu Feb 10 15:52:49 2011 -0800
@@ -1776,8 +1776,13 @@
 
   // 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 @@
 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())
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]