]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix mis-compilation when switching over channels
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 24 Jun 2024 19:35:19 +0000 (02:35 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 3 Jul 2024 18:07:19 +0000 (18:07 +0000)
commit5f50b1e3bf710b4107eb38496d932b3d9bd1fc98
tree2ebd14064679c2dbd46a0a538fc851b105776920
parent71f9dbb1e409a28680f40c60fad5a386ed92a096
cmd/compile: fix mis-compilation when switching over channels

CL 418101 changes Unified IR writer to force mixed tag/case to have
common type, emitting the implicit conversion if any of the case values
are not assignable to the tag value's type.

However, the Go spec definition of equality is non-transitive for
channels stored in interfaces, causing incorrect behavior with channel
values comparison.

To fix it, don't emit the implicit conversions if tag type is channel.

Fixes #67190

Change-Id: I9a29d9ce3c7978f0689e9502ba6f15660c763d16
Reviewed-on: https://go-review.googlesource.com/c/go/+/594575
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/noder/writer.go
test/fixedbugs/issue67190.go [new file with mode: 0644]