public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: lvalue context fixes in Unary_expression::do_get_backend
@ 2017-06-08 18:42 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2017-06-08 18:42 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

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

In the Go frontend a couple of the Backend::var_expression invocations
in Unary_expression::do_get_backend were selecting "lvalue" context
incorrectly (these var exprs were not in an assignment or LHS
position).  This patch by Than McIntosh fixes the problem by changing
them back to "rvalue" context.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

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

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 249028)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-4b857cde45939f0e9f3cf89b9e347b6f6ebe0f8f
+81d9f6d05c2bb92b2b3af02807713b6bed9bf053
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 249028)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -4370,7 +4370,7 @@ Unary_expression::do_get_backend(Transla
 	  gogo->backend()->implicit_variable_set_init(implicit, buf, btype,
 						      true, copy_to_heap, false,
 						      bexpr);
-	  bexpr = gogo->backend()->var_expression(implicit, VE_lvalue, loc);
+	  bexpr = gogo->backend()->var_expression(implicit, VE_rvalue, loc);
 
 	  // If we are not copying a slice initializer to the heap,
 	  // then it can be changed by the program, so if it can
@@ -4380,7 +4380,7 @@ Unary_expression::do_get_backend(Transla
 	      && this->expr_->type()->has_pointer())
 	    {
 	      Bexpression* root =
-                  gogo->backend()->var_expression(implicit, VE_lvalue, loc);
+                  gogo->backend()->var_expression(implicit, VE_rvalue, loc);
 	      root = gogo->backend()->address_expression(root, loc);
 	      Type* type = Type::make_pointer_type(this->expr_->type());
 	      gogo->add_gc_root(Expression::make_backend(root, type, loc));
@@ -4400,7 +4400,7 @@ Unary_expression::do_get_backend(Transla
                                                 true, false, btype, loc);
           gogo->backend()->immutable_struct_set_init(decl, buf, true, false,
                                                      btype, loc, bexpr);
-          bexpr = gogo->backend()->var_expression(decl, VE_lvalue, loc);
+          bexpr = gogo->backend()->var_expression(decl, VE_rvalue, loc);
         }
 
       go_assert(!this->create_temp_ || this->expr_->is_variable());

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

only message in thread, other threads:[~2017-06-08 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08 18:42 Go patch committed: lvalue context fixes in Unary_expression::do_get_backend 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).