]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue63955.go
cmd/compile: fix findIndVar so it does not match disjointed loop headers
[gostls13.git] / test / fixedbugs / issue63955.go
1 // compile
2
3 // Copyright 2023 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 package j
8
9 func f(try func() int, shouldInc func() bool, N func(int) int) {
10         var n int
11 loop: // we want to have 3 preds here, the function entry and both gotos
12         if v := try(); v == 42 || v == 1337 { // the two || are to trick findIndVar
13                 if n < 30 { // this aims to be the matched block
14                         if shouldInc() {
15                                 n++
16                                 goto loop
17                         }
18                         n = N(n) // try to prevent some block joining
19                         goto loop
20                 }
21         }
22 }