• Matthew Dempsky's avatar
    cmd/compile: fix "append outside assignment" ICE · c4f87ed2
    Matthew Dempsky authored
    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: default avatarJosh Bleecher Snyder <josharian@gmail.com>
    c4f87ed2
issue31010.go 364 Bytes