diff --git a/go/ssa/interp/testdata/coverage.go b/go/ssa/interp/testdata/coverage.go index 73fce59321..4f7ea77f45 100644 --- a/go/ssa/interp/testdata/coverage.go +++ b/go/ssa/interp/testdata/coverage.go @@ -635,6 +635,13 @@ func init() { if got := lenCapLoHi(s[1:3:3]); got != [4]int{2, 2, 1, 2} { panic(got) } + max := 3 + if v[2] == 42 { + max = 2 + } + if got := lenCapLoHi(s[1:2:max]); got != [4]int{1, 1, 1, 1} { + panic(got) + } } // Regression test for issue 7840 (covered by SSA sanity checker). diff --git a/go/ssa/ssa.go b/go/ssa/ssa.go index e68650ea63..d4d5333b2c 100644 --- a/go/ssa/ssa.go +++ b/go/ssa/ssa.go @@ -1655,7 +1655,7 @@ func (s *Send) Operands(rands []*Value) []*Value { } func (v *Slice) Operands(rands []*Value) []*Value { - return append(rands, &v.X, &v.Low, &v.High) + return append(rands, &v.X, &v.Low, &v.High, &v.Max) } func (s *Store) Operands(rands []*Value) []*Value {