Home | History | Annotate | Download | only in fixedbugs
      1 // run
      2 
      3 // Copyright 2012 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 // Issue 3899: 8g incorrectly thinks a variable is
      8 // "set but not used" and elides an assignment, causing
      9 // variables to end up with wrong data.
     10 //
     11 // The reason is a miscalculation of variable width.
     12 
     13 package main
     14 
     15 func bar(f func()) {
     16 	f()
     17 }
     18 
     19 func foo() {
     20 	f := func() {}
     21 	if f == nil {
     22 	}
     23 	bar(f)
     24 }
     25 
     26 func main() {
     27 	foo()
     28 }
     29