diff options
| author | Russ Cox <rsc@golang.org> | 2012-01-26 16:25:07 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-01-26 16:25:07 -0500 |
| commit | 408f0b1f7459ebcbc74ad5936950072796fe449a (patch) | |
| tree | 8b13422bc016157ca6a612913f638ff9bfc93446 /src/pkg/runtime/runtime.c | |
| parent | 109a9763550aac3071e30f6e13cb5ec1172aa017 (diff) | |
| download | go-408f0b1f7459ebcbc74ad5936950072796fe449a.tar.xz | |
gc, runtime: handle floating point map keys
Fixes #2609.
R=ken2
CC=golang-dev
https://golang.org/cl/5572069
Diffstat (limited to 'src/pkg/runtime/runtime.c')
| -rw-r--r-- | src/pkg/runtime/runtime.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index ed46150ea5..81caccad31 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -278,8 +278,8 @@ runtime·check(void) uint32 f; int64 g; uint64 h; - float32 i; - float64 j; + float32 i, i1; + float64 j, j1; void* k; uint16* l; struct x1 { @@ -319,6 +319,30 @@ runtime·check(void) if(z != 4) runtime·throw("cas4"); + *(uint64*)&j = ~0ULL; + if(j == j) + runtime·throw("float64nan"); + if(!(j != j)) + runtime·throw("float64nan1"); + + *(uint64*)&j1 = ~1ULL; + if(j == j1) + runtime·throw("float64nan2"); + if(!(j != j1)) + runtime·throw("float64nan3"); + + *(uint32*)&i = ~0UL; + if(i == i) + runtime·throw("float32nan"); + if(!(i != i)) + runtime·throw("float32nan1"); + + *(uint32*)&i1 = ~1UL; + if(i == i1) + runtime·throw("float32nan2"); + if(!(i != i1)) + runtime·throw("float32nan3"); + runtime·initsig(0); } |
