Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2019 18:52:36 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r348787 - stable/11/lib/msun/tests
Message-ID:  <201906071852.x57IqavD014354@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Jun  7 18:52:36 2019
New Revision: 348787
URL: https://svnweb.freebsd.org/changeset/base/348787

Log:
  MFC r348500:
  
  Partially revert r271349, which disabled the msun cexp test #4 on i386.
  
  Ensure the expected result is stored first in a volatile variable with
  the desired type.  This makes all the tests succeed.
  
  Slightly changed from the original pull request, but functionally the
  same.
  
  Approved by:	re (gjb)
  Obtained from:	https://github.com/freebsd/freebsd/pull/401
  Submitted by:	Moritz Buhl <gh@moritzbuhl.de>
  PR:		191676

Modified:
  stable/11/lib/msun/tests/cexp_test.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/msun/tests/cexp_test.c
==============================================================================
--- stable/11/lib/msun/tests/cexp_test.c	Fri Jun  7 18:34:48 2019	(r348786)
+++ stable/11/lib/msun/tests/cexp_test.c	Fri Jun  7 18:52:36 2019	(r348787)
@@ -59,13 +59,21 @@ __FBSDID("$FreeBSD$");
  * XXX The volatile here is to avoid gcc's bogus constant folding and work
  *     around the lack of support for the FENV_ACCESS pragma.
  */
-#define	test(func, z, result, exceptmask, excepts, checksign)	do {	\
+#define	test_t(type, func, z, result, exceptmask, excepts, checksign)	\
+do {									\
 	volatile long double complex _d = z;				\
+	volatile type complex _r = result;				\
 	assert(feclearexcept(FE_ALL_EXCEPT) == 0);			\
-	assert(cfpequal_cs((func)(_d), (result), (checksign)));		\
+	assert(cfpequal_cs((func)(_d), (_r), (checksign)));		\
 	assert(((void)(func), fetestexcept(exceptmask) == (excepts)));	\
 } while (0)
 
+#define	test(func, z, result, exceptmask, excepts, checksign)		\
+	test_t(double, func, z, result, exceptmask, excepts, checksign)
+
+#define	test_f(func, z, result, exceptmask, excepts, checksign)		\
+	test_t(float, func, z, result, exceptmask, excepts, checksign)
+
 /* Test within a given tolerance. */
 #define	test_tol(func, z, result, tol)				do {	\
 	volatile long double complex _d = z;				\
@@ -76,7 +84,7 @@ __FBSDID("$FreeBSD$");
 /* Test all the functions that compute cexp(x). */
 #define	testall(x, result, exceptmask, excepts, checksign)	do {	\
 	test(cexp, x, result, exceptmask, excepts, checksign);		\
-	test(cexpf, x, result, exceptmask, excepts, checksign);		\
+	test_f(cexpf, x, result, exceptmask, excepts, checksign);	\
 } while (0)
 
 /*
@@ -198,10 +206,10 @@ test_reals(void)
 		test(cexp, CMPLXL(finites[i], -0.0),
 		     CMPLXL(exp(finites[i]), -0.0),
 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
-		test(cexpf, CMPLXL(finites[i], 0.0),
+		test_f(cexpf, CMPLXL(finites[i], 0.0),
 		     CMPLXL(expf(finites[i]), 0.0),
 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
-		test(cexpf, CMPLXL(finites[i], -0.0),
+		test_f(cexpf, CMPLXL(finites[i], -0.0),
 		     CMPLXL(expf(finites[i]), -0.0),
 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
 	}
@@ -220,10 +228,10 @@ test_imaginaries(void)
 		test(cexp, CMPLXL(-0.0, finites[i]),
 		     CMPLXL(cos(finites[i]), sin(finites[i])),
 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
-		test(cexpf, CMPLXL(0.0, finites[i]),
+		test_f(cexpf, CMPLXL(0.0, finites[i]),
 		     CMPLXL(cosf(finites[i]), sinf(finites[i])),
 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
-		test(cexpf, CMPLXL(-0.0, finites[i]),
+		test_f(cexpf, CMPLXL(-0.0, finites[i]),
 		     CMPLXL(cosf(finites[i]), sinf(finites[i])),
 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
 	}
@@ -302,12 +310,8 @@ main(void)
 	test_inf();
 	printf("ok 3 - cexp inf\n");
 
-#if defined(__i386__)
-	printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on i386\n");
-#else
 	test_reals();
 	printf("ok 4 - cexp reals\n");
-#endif
 
 	test_imaginaries();
 	printf("ok 5 - cexp imaginaries\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906071852.x57IqavD014354>