[gccgo] Correct type of slice size passed to function

Submitted by Ian Taylor on June 27, 2010, 12:11 a.m.

Details

Message ID mcrd3vd1ghn.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor June 27, 2010, 12:11 a.m.
The size of a slice is stored as an int.  The builtin functions
__go_byte_array_to_string and __go_int_array_to_string currently take a
size_t argument.  This patch converts the size as required.  Committed
to gccgo branch.

Ian

Patch hide | download patch | download mbox

diff -r adeb0f21cd0d go/expressions.cc
--- a/go/expressions.cc	Sat Jun 26 17:08:21 2010 -0700
+++ b/go/expressions.cc	Sat Jun 26 17:09:53 2010 -0700
@@ -3371,6 +3371,7 @@ 
       tree valptr = fold_convert(const_ptr_type_node,
 				 a->value_pointer_tree(gogo, expr_tree));
       tree len = a->length_tree(gogo, expr_tree);
+      len = fold_convert_loc(this->location(), size_type_node, len);
       if (e->integer_type()->is_unsigned()
 	  && e->integer_type()->bits() == 8)
 	{