From bab79dd3627a9c5d4b43ac3f3c2eba4a1f04b813 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 7 Sep 2021 16:24:49 -0700 Subject: [PATCH] reflect: add back signaling NaN test 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 Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- src/reflect/all_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index eb3ddcb3e4..293d036f67 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -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))) -- 2.50.0