]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSwitch
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 14 Jan 2021 06:41:35 +0000 (13:41 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 14 Jan 2021 08:31:22 +0000 (08:31 +0000)
CL 283672 added a flag to prevent double walking, use that flag instead
of checking SwitchStmt.Compiled field.

Passes toolstash -cmp.

Change-Id: Idb8f9078412fb789f51ed4fc4206638011e38a93
Reviewed-on: https://go-review.googlesource.com/c/go/+/283733
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/walk/switch.go

index 59446ef3dbab49129a848377eb172f34a15ac3e8..0cc1830d3fc47b20c19f84b3ad9b6ab0df81cff6 100644 (file)
@@ -19,9 +19,10 @@ import (
 // walkSwitch walks a switch statement.
 func walkSwitch(sw *ir.SwitchStmt) {
        // Guard against double walk, see #25776.
-       if len(sw.Cases) == 0 && len(sw.Compiled) > 0 {
+       if sw.Walked() {
                return // Was fatal, but eliminating every possible source of double-walking is hard
        }
+       sw.SetWalked(true)
 
        if sw.Tag != nil && sw.Tag.Op() == ir.OTYPESW {
                walkSwitchType(sw)