diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-10-01 11:36:34 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-10-01 11:36:34 +0000 |
commit | e74736b544df96dbc776598af110eca43f82a3f0 (patch) | |
tree | 68d344400a27599cbb54a902a04697da83e6d421 /lib/libc | |
parent | 158f27f8e5c7f51c6cee3151019b090dff504a18 (diff) |
Make a var volatile, which forces a mem write at the right spot, and
detctecion of underflow where it would otherwise not happen for FPUs
that have a larger register size than sizeof double (i386, m68k). ok
deraadt@ weingart@ kettenis@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/strtod.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtod.c b/lib/libc/stdlib/strtod.c index d01158e10c1..3081cb5cc72 100644 --- a/lib/libc/stdlib/strtod.c +++ b/lib/libc/stdlib/strtod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtod.c,v 1.22 2006/05/19 14:15:27 thib Exp $ */ +/* $OpenBSD: strtod.c,v 1.23 2006/10/01 11:36:33 otto Exp $ */ /**************************************************************** * * The author of this software is David M. Gay. @@ -1128,7 +1128,12 @@ strtod(CONST char *s00, char **se) e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj, aadj1, adj; - _double rv, rv0; + /* + * volatile forces mem update for FPUs where reg size != sizeof double, + * which should trigger ERANGE in the case of underflow. + */ + volatile _double rv; + _double rv0; Long L; ULong y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; |