summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorotto <>2006-09-29 11:00:24 +0000
committerotto <>2006-09-29 11:00:24 +0000
commitb111751208a94882547ae748c16e7978fa7226b6 (patch)
tree5da3321fe5d4c05cad86a57aa9910780f3e3b577 /src
parent3e7a96453995beff0dd6bfbefb9db0b02fbb7ef5 (diff)
downloadopenbsd-b111751208a94882547ae748c16e7978fa7226b6.tar.gz
openbsd-b111751208a94882547ae748c16e7978fa7226b6.tar.bz2
openbsd-b111751208a94882547ae748c16e7978fa7226b6.zip
add strtod() underflow test
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libc/Makefile4
-rw-r--r--src/regress/lib/libc/strtod/Makefile5
-rw-r--r--src/regress/lib/libc/strtod/strtodtest.c22
3 files changed, 29 insertions, 2 deletions
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile
index a6d3d766b1..04970c7e16 100644
--- a/src/regress/lib/libc/Makefile
+++ b/src/regress/lib/libc/Makefile
@@ -1,9 +1,9 @@
1# $OpenBSD: Makefile,v 1.23 2006/03/25 20:28:19 otto Exp $ 1# $OpenBSD: Makefile,v 1.24 2006/09/29 11:00:24 otto Exp $
2 2
3SUBDIR+= _setjmp alloca atexit db getaddrinfo getcap getopt_long hsearch longjmp 3SUBDIR+= _setjmp alloca atexit db getaddrinfo getcap getopt_long hsearch longjmp
4SUBDIR+= locale malloc 4SUBDIR+= locale malloc
5SUBDIR+= netdb popen regex setjmp setjmp-signal sigreturn sigsetjmp 5SUBDIR+= netdb popen regex setjmp setjmp-signal sigreturn sigsetjmp
6SUBDIR+= sprintf strerror strtonum telldir time vis 6SUBDIR+= sprintf strerror strtod strtonum telldir time vis
7 7
8.if (${MACHINE_ARCH} != "vax") 8.if (${MACHINE_ARCH} != "vax")
9SUBDIR+= ieeefp 9SUBDIR+= ieeefp
diff --git a/src/regress/lib/libc/strtod/Makefile b/src/regress/lib/libc/strtod/Makefile
new file mode 100644
index 0000000000..030c0e7f56
--- /dev/null
+++ b/src/regress/lib/libc/strtod/Makefile
@@ -0,0 +1,5 @@
1# $OpenBSD: Makefile,v 1.1 2006/09/29 11:00:24 otto Exp $
2
3PROG= strtodtest
4
5.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/strtod/strtodtest.c b/src/regress/lib/libc/strtod/strtodtest.c
new file mode 100644
index 0000000000..0291365a75
--- /dev/null
+++ b/src/regress/lib/libc/strtod/strtodtest.c
@@ -0,0 +1,22 @@
1/* $OpenBSD: strtodtest.c,v 1.1 2006/09/29 11:00:24 otto Exp $ */
2/* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <errno.h>
7
8/*
9 * Checks if strtod() reports underflow.
10 */
11
12int
13main()
14{
15 char *tmp="0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002";
16 double d;
17
18 d = strtod(tmp, NULL);
19 if (errno != ERANGE)
20 errx(1, "errno = %d", errno);
21 return (0);
22}