Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/stdlib Try fixing t_strtod to not depend on -...



details:   https://anonhg.NetBSD.org/src/rev/0633b3502bde
branches:  trunk
changeset: 778554:0633b3502bde
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Apr 04 10:52:59 2012 +0000

description:
Try fixing t_strtod to not depend on -ffloat-store by adding the
necessary volatiles.

diffstat:

 tests/lib/libc/stdlib/Makefile   |   3 +--
 tests/lib/libc/stdlib/t_strtod.c |  24 ++++++++++++------------
 2 files changed, 13 insertions(+), 14 deletions(-)

diffs (121 lines):

diff -r 5f5347405cd9 -r 0633b3502bde tests/lib/libc/stdlib/Makefile
--- a/tests/lib/libc/stdlib/Makefile    Wed Apr 04 10:44:21 2012 +0000
+++ b/tests/lib/libc/stdlib/Makefile    Wed Apr 04 10:52:59 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2012/03/29 06:16:56 jruoho Exp $
+# $NetBSD: Makefile,v 1.23 2012/04/04 10:52:59 joerg Exp $
 
 .include <bsd.own.mk>
 
@@ -28,7 +28,6 @@
 PROGS+=                h_atexit
 PROGS+=                h_getopt h_getopt_long
 
-COPTS.t_strtod.c+=             -ffloat-store
 LDADD.t_strtod=                        -lm
 
 LDADD.t_getenv_thread=         -lpthread
diff -r 5f5347405cd9 -r 0633b3502bde tests/lib/libc/stdlib/t_strtod.c
--- a/tests/lib/libc/stdlib/t_strtod.c  Wed Apr 04 10:44:21 2012 +0000
+++ b/tests/lib/libc/stdlib/t_strtod.c  Wed Apr 04 10:52:59 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_strtod.c,v 1.28 2012/03/18 07:00:51 jruoho Exp $ */
+/*     $NetBSD: t_strtod.c,v 1.29 2012/04/04 10:52:59 joerg Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Public domain, Otto Moerbeek <otto%drijf.net@localhost>, 2006. */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtod.c,v 1.28 2012/03/18 07:00:51 jruoho Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.29 2012/04/04 10:52:59 joerg Exp $");
 
 #include <errno.h>
 #include <math.h>
@@ -92,7 +92,7 @@
 {
        const char *str;
        char *end;
-       double d;
+       volatile double d;
 
        str = "-0x0";
        d = strtod(str, &end);  /* -0.0 */
@@ -119,7 +119,7 @@
 {
 #ifndef __vax__
        for (size_t i = 0; i < __arraycount(inf_strings); i++) {
-               double d = strtod(inf_strings[i], NULL);
+               volatile double d = strtod(inf_strings[i], NULL);
                ATF_REQUIRE(isinf(d) != 0);
        }
 #else
@@ -137,7 +137,7 @@
 {
 #ifndef __vax__
        for (size_t i = 0; i < __arraycount(inf_strings); i++) {
-               float f = strtof(inf_strings[i], NULL);
+               volatile float f = strtof(inf_strings[i], NULL);
                ATF_REQUIRE(isinf(f) != 0);
        }
 #else
@@ -159,7 +159,7 @@
                atf_tc_expect_fail("PR misc/44767");
 
        for (size_t i = 0; i < __arraycount(inf_strings); i++) {
-               long double ld = strtold(inf_strings[i], NULL);
+               volatile long double ld = strtold(inf_strings[i], NULL);
                ATF_REQUIRE(isinf(ld) != 0);
        }
 #   else
@@ -181,7 +181,7 @@
 #ifndef __vax__
        char *end;
 
-       double d = strtod(nan_string, &end);
+       volatile double d = strtod(nan_string, &end);
        ATF_REQUIRE(isnan(d) != 0);
        ATF_REQUIRE(strcmp(end, "y") == 0);
 #else
@@ -200,7 +200,7 @@
 #ifndef __vax__
        char *end;
 
-       float f = strtof(nan_string, &end);
+       volatile float f = strtof(nan_string, &end);
        ATF_REQUIRE(isnanf(f) != 0);
        ATF_REQUIRE(strcmp(end, "y") == 0);
 #else
@@ -224,7 +224,7 @@
        if (system("cpuctl identify 0 | grep -q QEMU") == 0)
                atf_tc_expect_fail("PR misc/44767");
 
-       long double ld = strtold(nan_string, &end);
+       volatile long double ld = strtold(nan_string, &end);
        ATF_REQUIRE(isnan(ld) != 0);
        ATF_REQUIRE(__isnanl(ld) != 0);
        ATF_REQUIRE(strcmp(end, "y") == 0);
@@ -255,11 +255,11 @@
 
        (void)fesetround(FE_UPWARD);
 
-       double d1 = strtod(val, NULL);
+       volatile double d1 = strtod(val, NULL);
 
        (void)fesetround(FE_DOWNWARD);
 
-       double d2 = strtod(val, NULL);
+       volatile double d2 = strtod(val, NULL);
 
        if (fabs(d1 - d2) > 0.0)
                return;
@@ -292,7 +292,7 @@
            "000000000000000002";
 
        errno = 0;
-       double d = strtod(tmp, NULL);
+       volatile double d = strtod(tmp, NULL);
 
        if (d != 0 || errno != ERANGE)
                atf_tc_fail("strtod(3) did not detect underflow");



Home | Main Index | Thread Index | Old Index