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 when copying function without closure


A bug in the Go frontend caused it to crash when copying a function
expression if the function had no closure.  I'm not sure this ever
happens for valid code, but it can happen for invalid code.  This patch
fixes it in the obvious way.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 4e845d05aafc go/expressions.h
--- a/go/expressions.h	Tue Dec 21 14:29:32 2010 -0800
+++ b/go/expressions.h	Tue Dec 21 14:49:03 2010 -0800
@@ -1346,7 +1346,9 @@
   do_copy()
   {
     return Expression::make_func_reference(this->function_,
-					   this->closure_->copy(),
+					   (this->closure_ == NULL
+					    ? NULL
+					    : this->closure_->copy()),
 					   this->location());
   }
 

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