compiler: use int type for len & cap in slice value
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Jan 2019 00:05:12 +0000 (00:05 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Jan 2019 00:05:12 +0000 (00:05 +0000)
    Slice value expression has backend type a struct of a pointer and
    two ints. Make sure the len and cap are converted to int when
    creating slice value expression.

    Reviewed-on: https://go-review.googlesource.com/c/156897

From-SVN: r267745

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index 267c32b4fd08e24c8e3e4180836e4fd213a45463..40e5a2e8649d58040b31437fa35531ea3e48d76b 100644 (file)
@@ -1,4 +1,4 @@
-085ef4556ec810a5a9c422e7b86d98441dc92e86
+960637781ca9546ea2db913e48afd7eccbdadfa9
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 71f18002733d810fb0016ba23d23b6094fa765e8..4854c3cb2a337c55b6ae32b039993806304fcb18 100644 (file)
@@ -7821,8 +7821,10 @@ Builtin_call_expression::lower_make(Statement_inserter* inserter)
                                           cap_arg);
       mem = Expression::make_unsafe_cast(Type::make_pointer_type(et), mem,
                                         loc);
-      call = Expression::make_slice_value(type, mem, len_arg->copy(),
-                                         cap_arg->copy(), loc);
+      Type* int_type = Type::lookup_integer_type("int");
+      len_arg = Expression::make_cast(int_type, len_arg->copy(), loc);
+      cap_arg = Expression::make_cast(int_type, cap_arg->copy(), loc);
+      call = Expression::make_slice_value(type, mem, len_arg, cap_arg, loc);
     }
   else if (is_map)
     {