]> Cypherpunks.ru repositories - gostls13.git/commitdiff
reflect: add back signaling NaN test
authorKeith Randall <khr@golang.org>
Tue, 7 Sep 2021 23:24:49 +0000 (16:24 -0700)
committerKeith Randall <khr@golang.org>
Wed, 8 Sep 2021 00:34:17 +0000 (00:34 +0000)
I was a little too agressive in CL 258957 (removing 387 support) in
removing a signaling NaN test that should probably still exist.
I should have just removed the 387 skip, not the entire test.

Change-Id: I97ca53f190eb0de00e43b96629b2cae677e7dacb
Reviewed-on: https://go-review.googlesource.com/c/go/+/348209
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/reflect/all_test.go

index eb3ddcb3e4b935eb22d7b40a84e157dc80ea1508..293d036f6725c1d1e77bc43515d94fe418a9de0c 100644 (file)
@@ -4431,6 +4431,14 @@ var gFloat32 float32
 const snan uint32 = 0x7f800001
 
 func TestConvertNaNs(t *testing.T) {
+       // Test to see if a store followed by a load of a signaling NaN
+       // maintains the signaling bit. (This used to fail on the 387 port.)
+       gFloat32 = math.Float32frombits(snan)
+       runtime.Gosched() // make sure we don't optimize the store/load away
+       if got := math.Float32bits(gFloat32); got != snan {
+               t.Errorf("store/load of sNaN not faithful, got %x want %x", got, snan)
+       }
+       // Test reflect's conversion between float32s. See issue 36400.
        type myFloat32 float32
        x := V(myFloat32(math.Float32frombits(snan)))
        y := x.Convert(TypeOf(float32(0)))