diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-01-09 00:05:12 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-01-09 00:05:12 +0000 |
commit | fc490e0478f67c12e9662c177fed87f47456cea5 (patch) | |
tree | 28ec169a2fc7627e5f036ae29b2d01135b501992 | |
parent | 52af30719fde1430bd4c4a686fe4375be1a7b0cf (diff) | |
download | gcc-fc490e0478f67c12e9662c177fed87f47456cea5.zip gcc-fc490e0478f67c12e9662c177fed87f47456cea5.tar.gz gcc-fc490e0478f67c12e9662c177fed87f47456cea5.tar.bz2 |
compiler: use int type for len & cap in slice value
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
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 267c32b..40e5a2e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 71f1800..4854c3c 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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) { |