• 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
..
internal Loading commit data...
README.md Loading commit data...
doc.go Loading commit data...
fmt_test.go Loading commit data...
fmtmap_test.go Loading commit data...
main.go Loading commit data...