mirror of
https://github.com/golang/go
synced 2024-11-18 10:24:42 -07:00
599f56dc05
Don't do direct loads from argument slots if the sizes don't match. This prevents us from loading from a float32 using a uint64 load during expressions like uint64(math.float32Bits(f)) where f is a float32 arg. Fixes #25322 Change-Id: I3887d76f78c844ba546243e7721d811c3d4a9700 Reviewed-on: https://go-review.googlesource.com/112637 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
24 lines
381 B
Go
24 lines
381 B
Go
// cmpout
|
|
|
|
// Copyright 2018 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.
|
|
|
|
// Missing zero extension when converting a float32
|
|
// to a uint64.
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"math"
|
|
)
|
|
|
|
func Foo(v float32) {
|
|
fmt.Printf("%x\n", uint64(math.Float32bits(v)))
|
|
}
|
|
|
|
func main() {
|
|
Foo(2.0)
|
|
}
|