diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-21 22:29:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-21 22:29:58 +0000 |
commit | 36f1a35f6931f67f7daec5aa7803a6475e8087ca (patch) | |
tree | 889baf8014d262a99a61e506c38e8b250ce27e47 /gcc/go | |
parent | 3f741f1b6014b8c903e1ddbd8ce1b7394cc301cc (diff) | |
download | gcc-36f1a35f6931f67f7daec5aa7803a6475e8087ca.zip gcc-36f1a35f6931f67f7daec5aa7803a6475e8087ca.tar.gz gcc-36f1a35f6931f67f7daec5aa7803a6475e8087ca.tar.bz2 |
compiler: fix missing case in Array_type::get_value_pointer
Update the code in Array_type::get_value_pointer that handles
"lvalue" context to look for both regular var expressions
and temp var expressions, since both can appear in array/slice
index expressions on the left hand side of assignments.
Reviewed-on: https://go-review.googlesource.com/46170
From-SVN: r249486
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 7eb0770..f6f0c68 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a4b455aa584e0d6e362a88597f11bba1427088e2 +0b93af68feb0a4135e83dd9e6c11df1563d862a9 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/types.cc b/gcc/go/gofrontend/types.cc index 912a23e..b9ad41e 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -7635,12 +7635,19 @@ Array_type::get_value_pointer(Gogo*, Expression* array, bool is_lvalue) const { Temporary_reference_expression* tref = array->temporary_reference_expression(); + Var_expression* ve = array->var_expression(); if (tref != NULL) { tref = tref->copy()->temporary_reference_expression(); tref->set_is_lvalue(); array = tref; } + else if (ve != NULL) + { + ve = new Var_expression(ve->named_object(), ve->location()); + ve->set_in_lvalue_pos(); + array = ve; + } } return Expression::make_slice_info(array, |