summaryrefslogtreecommitdiffstats
path: root/test/fixedbugs/bug450.go
blob: f64063a26c289e8f35d1d071ceb22fb50876438d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// run

// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Issue 3899: 8g incorrectly thinks a variable is
// "set and not used" and elides an assignment, causing
// variables to end up with wrong data.
//
// The reason is a miscalculation of variable width.

package main

func bar(f func()) {
	f()
}

func foo() {
	f := func() {}
	if f == nil {
	}
	bar(f)
}

func main() {
	foo()
}