public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Fix missing case in Array_type::get_lvalue_pointer
@ 2017-06-21 22:30 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2017-06-21 22:30 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

This patch from Than McIntosh fixes a missing case in
Array_type::get_value_pointer in the Go frontend.  It updates 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.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1232 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 249477)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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.
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 249208)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -7635,12 +7635,19 @@ Array_type::get_value_pointer(Gogo*, Exp
     {
       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,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-21 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 22:30 Go patch committed: Fix missing case in Array_type::get_lvalue_pointer Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).