aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/ssa/sccp.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/sccp.go b/src/cmd/compile/internal/ssa/sccp.go
index 9b958d0454..7ef8d6b7c1 100644
--- a/src/cmd/compile/internal/ssa/sccp.go
+++ b/src/cmd/compile/internal/ssa/sccp.go
@@ -507,6 +507,10 @@ func (t *worklist) propagate(block *Block) {
branchIdx = 1 - condLattice.val.AuxInt
} else {
branchIdx = condLattice.val.AuxInt
+ if branchIdx < 0 || branchIdx >= int64(len(block.Succs)) {
+ // unreachable code, do nothing then
+ break
+ }
}
t.edges = append(t.edges, block.Succs[branchIdx])
} else {