]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: ensure interface-to-concrete comparison panics when it should
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Fri, 24 May 2019 18:27:40 +0000 (01:27 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 28 Aug 2019 19:45:00 +0000 (19:45 +0000)
commit25ebf015f62c7e3ec8d1eaa56ba7c73c510fc040
treec24673c479d626fb9e644393f77951d035a9a12f
parent400d02123303115cc46a2ccc949bdcc2bfcc30e4
cmd/compile: ensure interface-to-concrete comparison panics when it should

In interface-to-concrete comparisons, we are short circuiting on the interface
value's dynamic type before evaluating the concrete expression for side effects,
causing concrete expression won't panic at runtime, while it should.

To fix it, evaluating the RHS of comparison before we do the short-circuit.

We also want to prioritize panics in the LHS over the RHS, so evaluating
the LHS too.

Fixes #32187

Change-Id: I15b58a523491b7fd1856b8fdb9ba0cba5d11ebb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/178817
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/walk.go
test/fixedbugs/issue32187.go [new file with mode: 0644]