summaryrefslogtreecommitdiff
path: root/src/cmd/gc/obj.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-15 12:57:09 -0800
committerRuss Cox <rsc@golang.org>2009-11-15 12:57:09 -0800
commita58fd66357f6b2b1cf1b50d0f93eb30fd28d7693 (patch)
tree4df91b85cdb8c5bfe3bb1ac5be58df0e5ecd375d /src/cmd/gc/obj.c
parent9c40101b22b381b3946e373a6d50000d348146f5 (diff)
downloadgolang-a58fd66357f6b2b1cf1b50d0f93eb30fd28d7693.tar.gz
gc: five bug fixes, one better error.
* check for struct literal assignment to private fields. * record, fix crash involving parallel map assignment. * avoid infinite recursion in exportassignok. * make floating point bounds check precise. * avoid crash on invalid receiver. * add context to error about implicit assignment. Fixes issue 86. Fixes issue 88. Fixes issue 158. Fixes issue 174. Fixes issue 201. Fixes issue 204. R=ken2 http://codereview.appspot.com/154144
Diffstat (limited to 'src/cmd/gc/obj.c')
-rw-r--r--src/cmd/gc/obj.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cmd/gc/obj.c b/src/cmd/gc/obj.c
index 49216b953..5b6bb1bf3 100644
--- a/src/cmd/gc/obj.c
+++ b/src/cmd/gc/obj.c
@@ -114,6 +114,7 @@ ieeedtod(uint64 *ieee, double native)
double fr, ho, f;
int exp;
uint32 h, l;
+ uint64 bits;
if(native < 0) {
ieeedtod(ieee, -native);
@@ -129,13 +130,20 @@ ieeedtod(uint64 *ieee, double native)
fr = modf(fr*f, &ho);
h = ho;
h &= 0xfffffL;
- h |= (exp+1022L) << 20;
f = 65536L;
fr = modf(fr*f, &ho);
l = ho;
l <<= 16;
l |= (int32)(fr*f);
- *ieee = ((uint64)h << 32) | l;
+ bits = ((uint64)h<<32) | l;
+ if(exp < -1021) {
+ // gradual underflow
+ bits |= 1LL<<52;
+ bits >>= -1021 - exp;
+ exp = -1022;
+ }
+ bits |= (uint64)(exp+1022L) << 52;
+ *ieee = bits;
}
int