1// run 2 3// Copyright 2021 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 7package main 8 9//go:noinline 10func f(c bool) int { 11 b := true 12 x := 0 13 y := 1 14 for b { 15 b = false 16 y = x 17 x = 2 18 if c { 19 return 3 20 } 21 } 22 return y 23} 24 25func main() { 26 if got := f(false); got != 0 { 27 panic(got) 28 } 29} 30