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: Fix append with no extra arguments


This patch fixes the Go frontend to correctly handle append when called
with a single argument.  Varargs conversion will cause the second
argument to be nil.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 73feef233434 go/expressions.cc
--- a/go/expressions.cc	Wed Dec 22 16:38:44 2010 -0800
+++ b/go/expressions.cc	Wed Dec 22 16:49:59 2010 -0800
@@ -7926,10 +7926,16 @@
 	if (arg1_tree == error_mark_node || arg2_tree == error_mark_node)
 	  return error_mark_node;
 
-	Array_type* at2 = arg2->type()->array_type();
+	arg2_tree = Expression::convert_for_assignment(context, at,
+						       arg2->type(),
+						       arg2_tree,
+						       location);
+	if (arg2_tree == error_mark_node)
+	  return error_mark_node;
+
 	arg2_tree = save_expr(arg2_tree);
-	tree arg2_val = at2->value_pointer_tree(gogo, arg2_tree);
-	tree arg2_len = at2->length_tree(gogo, arg2_tree);
+	tree arg2_val = at->value_pointer_tree(gogo, arg2_tree);
+	tree arg2_len = at->length_tree(gogo, arg2_tree);
 	if (arg2_val == error_mark_node || arg2_len == error_mark_node)
 	  return error_mark_node;
 	arg2_val = fold_convert_loc(location, ptr_type_node, arg2_val);

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