• David Chase's avatar
    cmd/compile: prevent double-walk of switch for OPRINT/OPRINTN · d924c333
    David Chase authored
    When a println arg contains a call to an inlineable function
    that itself contains a switch, that switch statement will be
    walked twice, once by the walkexprlist formerly in the
    OPRINT/OPRINTN case, then by walkexprlistcheap in walkprint.
    
    Remove the first walkexprlist, it is not necessary.
    walkexprlist =
    		s[i] = walkexpr(s[i], init)
    walkexprlistcheap = {
    		s[i] = cheapexpr(n, init)
    		s[i] = walkexpr(s[i], init)
    }
    
    Seems like this might be possible in other places, i.e.,
    calls to inlineable switch-containing functions.
    
    See also #25776.
    Fixes #29220.
    
    Change-Id: I3781e86aad6688711597b8bee9bc7ebd3af93601
    Reviewed-on: https://go-review.googlesource.com/c/154497
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    d924c333
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...