]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.22] cmd/compile: fix copying SSA-able variables optimization
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 7 Mar 2024 07:49:30 +0000 (14:49 +0700)
committerThan McIntosh <thanm@google.com>
Tue, 26 Mar 2024 19:24:40 +0000 (19:24 +0000)
commite71b0b1fee7df59a99ab6b5192854695d21ff688
treecef76a7e2d5291dab3d93fb3f76fbf38249fd950
parent9508eae5d11a518dd650f8964d0201b9fa1760c1
[release-branch.go1.22] cmd/compile: fix copying SSA-able variables optimization

CL 541715 added an optimization to copy SSA-able variables.

When handling m[k] = append(m[k], ...) case, it uses ir.SameSafeExpr to
check that m[k] expressions are the same, then doing type assertion to
convert the map index to ir.IndexExpr node. However, this assertion is
not safe for m[k] expression in append(m[k], ...), since it may be
wrapped by ir.OCONVNOP node.

Fixing this by un-wrapping any ir.OCONVNOP before doing type assertion.

Fixes #66178

Change-Id: I9ff7165ab97bc7f88d0e9b7b31604da19a8ca206
Reviewed-on: https://go-review.googlesource.com/c/go/+/569716
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569818
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/walk/order.go
test/fixedbugs/issue66096.go [new file with mode: 0644]