]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix "append outside assignment" ICE
authorMatthew Dempsky <mdempsky@google.com>
Mon, 25 Mar 2019 23:34:19 +0000 (16:34 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 26 Mar 2019 02:20:09 +0000 (02:20 +0000)
commitc4f87ed26ffc17e6cf326d33e49f639d9bf7cf86
tree5a00d5ce27e2c8d9f0e9daac30683cf29fc5b99d
parent270de1c110221c309c832b526012f3e21b35f581
cmd/compile: fix "append outside assignment" ICE

Some special-case code paths in order.go didn't expect OCALLFUNC to
have Ninit; in particular, OAS2FUNC and ODEFER/OGO failed to call
o.init on their child OCALLFUNC node. This resulted in not all of the
AST being properly ordered.

This was noticed because order is responsible for introducing an
invariant around how OAPPEND is used, which is enforced by walk.
However, there were perhaps simpler cases (e.g., simple order of
evaluation) that were being silently miscompiled.

Fixes #31010.

Change-Id: Ib928890ab5ec2aebd8e30a030bc2b404387f9123
Reviewed-on: https://go-review.googlesource.com/c/go/+/169257
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/gc/order.go
test/fixedbugs/issue31010.go [new file with mode: 0644]