Rémy Oudompheng | 2ece2f5 | 2012-02-18 22:15:42 +0100 | [diff] [blame] | 1 | // run |
Anthony Martin | f570d9d | 2011-05-16 22:14:56 -0400 | [diff] [blame] | 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 | */ |