]> Cypherpunks repositories - gostls13.git/commit
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)
committerCherry Zhang <cherryyz@google.com>
Wed, 3 Oct 2018 15:01:47 +0000 (15:01 +0000)
commitc96e3bcc97a965b3e2947cc1d8d831b8d39c1d73
tree31c94d72b196ba52128249159887829865119597
parent54f5a6674a9463fecb8656c9ffc6d80374c5868d
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>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewriteARM64.go
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue27961.go [new file with mode: 0644]