cmd/compile: fixing writebarrier.go for -G=3

This is caused by some nodes didn't carry the real line number.
Noder1 wraps these node with ir.ParenExpr. To fix this issue,
wraps this node like what noder1 does.

Change-Id: I212cad09b93b8bf1a7adfad416d229d15711918a
Reviewed-on: https://go-review.googlesource.com/c/go/+/349769
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Keith Randall <khr@golang.org>
This commit is contained in:
wdvxdr 2021-09-14 13:37:21 +08:00 committed by Matthew Dempsky
parent bcdc61d830
commit d09e09bc61
5 changed files with 14 additions and 7 deletions

View file

@ -390,9 +390,10 @@ func (g *irgen) compLit(typ types2.Type, lit *syntax.CompositeLit) ir.Node {
} else {
key = g.expr(elem.Key)
}
exprs[i] = ir.NewKeyExpr(g.pos(elem), key, g.expr(elem.Value))
value := wrapname(g.pos(elem.Value), g.expr(elem.Value))
exprs[i] = ir.NewKeyExpr(g.pos(elem), key, value)
default:
exprs[i] = g.expr(elem)
exprs[i] = wrapname(g.pos(elem), g.expr(elem))
}
}