1// compile 2 3// Copyright 2018 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// This program results in a loop inferred to increment 8// j by 0, causing bounds check elimination to attempt 9// something%0, which panics (in the bug). 10 11package q 12 13func f() { 14 var s1 string 15 var b bool 16 if b { 17 b = !b 18 s1 += "a" 19 } 20 21 var s2 string 22 var i, j int 23 if (s1 <= "") || (s2 >= "") { 24 j = len(s1[:6]) 25 } else { 26 i = len("b") 27 } 28 29 for j < 0 { 30 j += i 31 } 32} 33