• Dan Scales's avatar
    cmd/compile: handle some missing cases of non-SSAable values for args of open-coded defers · cc47b0d2
    Dan Scales authored
    In my experimentation, I had found that most non-SSAable expressions were
    converted to autotmp variables during AST evaluation. However, this was not true
    generally, as witnessed by issue #35213, which has a non-SSAable field reference
    of a struct that is not converted to an autotmp. So, I fixed openDeferSave() to
    handle non-SSAable nodes more generally, and make sure that these non-SSAable
    expressions are not evaluated more than once (which could incorrectly repeat side
    effects).
    
    Fixes #35213
    
    Change-Id: I8043d5576b455e94163599e930ca0275e550d594
    Reviewed-on: https://go-review.googlesource.com/c/go/+/203888
    Run-TryBot: Dan Scales <danscales@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    cc47b0d2
defer_test.go 6.03 KB