go/ssa: fix incorrect SSA code for composite literals
Composite literals are initialized in place where possible, but in
cases the initializer expression refers to the variable that
is being updated
x = T{a: x.a}
we must ensure that the RHS is fully evaluated before we execute any
stores to x. This means we need to record the sequence of stores in a
"store buffer" and execute it only once the entire composite literal
has been evaluated.
Fixes issue #10127
Change-Id: If94e3b179beb25feea5b298ed43de6a199aaf347
Reviewed-on: https://go-review.googlesource.com/7533
Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/go/ssa/lvalue.go b/go/ssa/lvalue.go
index 8342645..4284b1c 100644
--- a/go/ssa/lvalue.go
+++ b/go/ssa/lvalue.go
@@ -29,7 +29,7 @@
type address struct {
addr Value
pos token.Pos // source position
- expr ast.Expr // source syntax [debug mode]
+ expr ast.Expr // source syntax of the value (not address) [debug mode]
}
func (a *address) load(fn *Function) Value {