Patchwork Go patch committed: Don't crash when copying call with no arguments

login
register
mail settings
Submitter Ian Taylor
Date Dec. 16, 2010, 1:47 a.m.
Message ID <mcraak6zdy0.fsf@google.com>
Download mbox | patch
Permalink /patch/75715/
State New
Headers show

Comments

Ian Taylor - Dec. 16, 2010, 1:47 a.m.
I committed this patch to the Go frontend to not crash when copying a
call with no arguments.  Bootstrapped and tested on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r 941f436a91ac go/expressions.h
--- a/go/expressions.h	Wed Dec 15 17:25:04 2010 -0800
+++ b/go/expressions.h	Wed Dec 15 17:35:19 2010 -0800
@@ -1235,7 +1235,10 @@ 
   Expression*
   do_copy()
   {
-    return Expression::make_call(this->fn_->copy(), this->args_->copy(),
+    return Expression::make_call(this->fn_->copy(),
+				 (this->args_ == NULL
+				  ? NULL
+				  : this->args_->copy()),
 				 this->is_varargs_, this->location());
   }