Source file test/fixedbugs/bug258.go

     1  // run
     2  
     3  // Copyright 2010 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 main
     8  
     9  import "math"
    10  
    11  func f() float64 {
    12  	math.Pow(2, 2)
    13  	return 1
    14  }
    15  
    16  func main() {
    17  	for i := 0; i < 10; i++ {
    18  		// 386 float register bug used to load constant before call
    19  		if -5 < f() {
    20  		} else {
    21  			println("BUG 1")
    22  			return
    23  		}
    24  		if f() > -7 {
    25  		} else {
    26  			println("BUG 2")
    27  		}
    28  
    29  		if math.Pow(2, 3) != 8 {
    30  			println("BUG 3")
    31  		}
    32  	}
    33  }
    34  

View as plain text