]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: modify swt.go to skip repeated walks of switch
authorDavid Chase <drchase@google.com>
Fri, 4 Jan 2019 16:43:23 +0000 (11:43 -0500)
committerDavid Chase <drchase@google.com>
Fri, 4 Jan 2019 21:51:37 +0000 (21:51 +0000)
commit28fb8c69871ff3edecb0951e50f7caf38943ec5d
treea2d82f7964fa7581f413de78454b25d7d531195c
parent86e31bc5fdde06d406b95cf8b5971755c78ec549
cmd/compile: modify swt.go to skip repeated walks of switch

The compiler appears to contain several squirrelly corner
cases where nodes are double walked, some where new nodes
are created from walked parts.  Rather than trust that we
had searched hard enough for the last one, change
exprSwitch.walk() to return immediately if it has already
been walked.  This appears to be the only case where
double-walking a node is actually harmful.

Fixes #29562.

Change-Id: I0667e8769aba4c3236666cd836a934e256c0bfc5
Reviewed-on: https://go-review.googlesource.com/c/156317
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/swt.go
test/fixedbugs/issue29562.go [new file with mode: 0644]