]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix constructing expr side-effects when comparing 0-size types
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 4 May 2022 18:00:38 +0000 (01:00 +0700)
committerGopher Robot <gobot@golang.org>
Thu, 5 May 2022 04:53:27 +0000 (04:53 +0000)
commit0e90ba933565ab6e719d6981d8d6195e06625f47
treeef5b268b67fe7918f9cd21d4f42ba60fb8358246
parentd544591d72ade40d34d7a8ee70e7239ae63b4116
cmd/compile: fix constructing expr side-effects when comparing 0-size types

In walkCompare, any ir.OCONVNOP was removed from both operands. So when
constructing assignments for them to preserve any side-effects, using
temporary variables can cause type mismatched with original type.

Instead, using blank assignments will prevent that issue and still make
sure that the operands will be evaluated.

Fixes #52701

Change-Id: I229046acb154890bb36fe441d258563687fdce37
Reviewed-on: https://go-review.googlesource.com/c/go/+/403997
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/walk/compare.go
test/fixedbugs/issue52701.go [new file with mode: 0644]