Patchwork Go patch committed: Correct test for number of args to append

login
register
mail settings
Submitter Ian Taylor
Date Dec. 22, 2010, 6:37 a.m.
Message ID <mcrd3ouia8m.fsf@google.com>
Download mbox | patch
Permalink /patch/76365/
State New
Headers show

Comments

Ian Taylor - Dec. 22, 2010, 6:37 a.m.
This patch to the Go frontend corrects the test for the number of
arguments to the predeclared function append.  It must have at least two
arguments.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r 9b8a9398feb4 go/expressions.cc
--- a/go/expressions.cc	Tue Dec 21 22:27:13 2010 -0800
+++ b/go/expressions.cc	Tue Dec 21 22:30:35 2010 -0800
@@ -7382,7 +7382,7 @@ 
     case BUILTIN_APPEND:
       {
 	const Expression_list* args = this->args();
-	if (args == NULL || args->empty())
+	if (args == NULL || args->size() < 2)
 	  {
 	    this->report_error(_("not enough arguments"));
 	    break;