]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.11] cmd/compile: fix type of OffPtr in some optimization rules
authorCherry Zhang <cherryyz@google.com>
Wed, 3 Oct 2018 02:04:45 +0000 (22:04 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 3 Oct 2018 18:08:44 +0000 (18:08 +0000)
commitaa0966105ea3c6fd338eb0e52d6e741702e79402
tree279a379e5612440e2b9e4f1e05d3f27131d0a68d
parent19fe28a3dc91ffb6f3ec31211abb3bf7ae088fb6
[release-branch.go1.11] cmd/compile: fix type of OffPtr in some optimization rules

In some optimization rules the type of generated OffPtr was
incorrectly set to the type of the pointee, instead of the
pointer. When the OffPtr value is spilled, this may generate
a spill of the wrong type, e.g. a floating point spill of an
integer (pointer) value. On Wasm, this leads to invalid
bytecode.

Fixes #27961.

Change-Id: I5d464847eb900ed90794105c0013a1a7330756cc
Reviewed-on: https://go-review.googlesource.com/c/139257
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
(cherry picked from commit c96e3bcc97a965b3e2947cc1d8d831b8d39c1d73)
Reviewed-on: https://go-review.googlesource.com/c/139104
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue27961.go [new file with mode: 0644]