]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix ordering problems in struct equality
authorKeith Randall <khr@golang.org>
Mon, 15 Jun 2020 16:17:18 +0000 (09:17 -0700)
committerKeith Randall <khr@golang.org>
Mon, 15 Jun 2020 18:03:08 +0000 (18:03 +0000)
commit8c8045fd381adf990ffc583ecabd9cf2a32a2a80
tree603557674afd7f7dc6d819f9214c5fa56b6579c7
parent8a33a8c6524b4f2175a9ff263db23eed825ea833
cmd/compile: fix ordering problems in struct equality

Make sure that if a field comparison might panic, we evaluate
(and short circuit if not equal) all previous fields, and don't
evaluate any subsequent fields.

Add a bunch more tests to the equality+panic checker.

Update #8606

Change-Id: I6a159bbc8da5b2b7ee835c0cd1fc565575b58c46
Reviewed-on: https://go-review.googlesource.com/c/go/+/237919
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/alg.go
test/fixedbugs/issue8606.go