modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug341.go (about)

     1  // run
     2  
     3  // Copyright 2011 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  // Used to panic because 8g was generating incorrect
     8  // code for converting a negative float to a uint64.
     9  
    10  package main
    11  
    12  func main() {
    13  	var x float32 = -2.5
    14  
    15  	_ = uint64(x)
    16  	_ = float32(0)
    17  }
    18  /*
    19  panic: runtime error: floating point error
    20  
    21  [signal 0x8 code=0x6 addr=0x8048c64 pc=0x8048c64]
    22  */