• Matthew Dempsky's avatar
    cmd/compile: fix evaluation order for OASOP · 34db5f0c
    Matthew Dempsky authored
    Currently, we handle "x op= y" by rewriting as "x = x op y", while
    ensuring that any calls or receive operations in 'x' are only
    evaluated once. Notably, pointer indirection, indexing operations,
    etc. are left alone as it's typically safe to re-evaluate those.
    
    However, those operations were interleaved with evaluating 'y', which
    could include function calls that might cause re-evaluation to yield
    different memory addresses.
    
    As a fix, simply ensure that we order side-effecting operations in 'y'
    before either evaluation of 'x'.
    
    Fixes #21687.
    
    Change-Id: Ib14e77760fda9c828e394e8e362dc9e5319a84b2
    Reviewed-on: https://go-review.googlesource.com/60091
    Run-TryBot: Matthew Dempsky <mdempsky@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    34db5f0c
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...