Module Name:    src
Committed By:   joerg
Date:           Wed Apr  4 10:52:59 UTC 2012

Modified Files:
        src/tests/lib/libc/stdlib: Makefile t_strtod.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libc/stdlib/Makefile
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libc/stdlib/t_strtod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/Makefile
diff -u src/tests/lib/libc/stdlib/Makefile:1.22 src/tests/lib/libc/stdlib/Makefile:1.23
--- src/tests/lib/libc/stdlib/Makefile:1.22	Thu Mar 29 06:16:56 2012
+++ src/tests/lib/libc/stdlib/Makefile	Wed Apr  4 10:52:59 2012
@@ -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 @@ BINDIR=		${TESTSDIR}
 PROGS+=		h_atexit
 PROGS+=		h_getopt h_getopt_long
 
-COPTS.t_strtod.c+=		-ffloat-store
 LDADD.t_strtod=			-lm
 
 LDADD.t_getenv_thread=		-lpthread

Index: src/tests/lib/libc/stdlib/t_strtod.c
diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.28 src/tests/lib/libc/stdlib/t_strtod.c:1.29
--- src/tests/lib/libc/stdlib/t_strtod.c:1.28	Sun Mar 18 07:00:51 2012
+++ src/tests/lib/libc/stdlib/t_strtod.c	Wed Apr  4 10:52:59 2012
@@ -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 <[email protected]>, 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 @@ ATF_TC_BODY(strtod_hex, tc)
 {
 	const char *str;
 	char *end;
-	double d;
+	volatile double d;
 
 	str = "-0x0";
 	d = strtod(str, &end);	/* -0.0 */
@@ -119,7 +119,7 @@ ATF_TC_BODY(strtod_inf, tc)
 {
 #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 @@ ATF_TC_BODY(strtof_inf, tc)
 {
 #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_BODY(strtold_inf, tc)
 		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 @@ ATF_TC_BODY(strtod_nan, tc)
 #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 @@ ATF_TC_BODY(strtof_nan, tc)
 #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 @@ ATF_TC_BODY(strtold_nan, tc)
 	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 @@ ATF_TC_BODY(strtod_round, tc)
 
 	(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 @@ ATF_TC_BODY(strtod_underflow, tc)
 	    "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");

Reply via email to