• David Chase's avatar
    cmd/compile: ensure that operand of ORETURN is not double-walked · c359d759
    David Chase authored
    Inlining of switch statements into a RETURNed expression
    can sometimes lead to the switch being walked twice, which
    results in a miscompiled switch statement. The bug depends
    on:
    
    1) multiple results
    2) named results
    3) a return statement whose expression includes a call to a
    function containing a switch statement that is inlined.
    
    It may also be significant that the default case of that
    switch is a panic(), though that's not proven.
    
    Rearranged the walk case for ORETURN so that double walks are
    not possible.  Added a test, because this is so fiddly.
    Added a check against double walks, verified that it fires
    w/o other fix.
    
    Fixes #25776.
    
    Change-Id: I2d594351fa082632512ef989af67eb887059729b
    Reviewed-on: https://go-review.googlesource.com/118318
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
    c359d759
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...