Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2019 07:39:31 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351596 - in head: sys/sys tests/sys/sys
Message-ID:  <201908290739.x7T7dVkJ069824@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Aug 29 07:39:31 2019
New Revision: 351596
URL: https://svnweb.freebsd.org/changeset/base/351596

Log:
  Fix qmath(3) build problems with GCC 8.
  
  Discussed with:	asomers
  Sponsored by:	Klara Systems
  Differential Revision:	https://reviews.freebsd.org/D21442

Modified:
  head/sys/sys/qmath.h
  head/tests/sys/sys/qmath_test.c

Modified: head/sys/sys/qmath.h
==============================================================================
--- head/sys/sys/qmath.h	Thu Aug 29 07:34:14 2019	(r351595)
+++ head/sys/sys/qmath.h	Thu Aug 29 07:39:31 2019	(r351596)
@@ -267,7 +267,7 @@ typedef	u64q_t		umaxq_t;
 
 /* Left shift an integral value to align with the int bits of 'q'. */
 #define	Q_SHL(q, iv) \
-    (Q_LTZ(iv) ? -(Q_ABS(iv) << Q_NFBITS(q)) :	\
+    (Q_LTZ(iv) ? -(int64_t)(Q_ABS(iv) << Q_NFBITS(q)) :	\
     Q_TC(q, iv) << Q_NFBITS(q))
 
 /* Calculate the relative fractional precision between 'a' and 'b' in bits. */

Modified: head/tests/sys/sys/qmath_test.c
==============================================================================
--- head/tests/sys/sys/qmath_test.c	Thu Aug 29 07:34:14 2019	(r351595)
+++ head/tests/sys/sys/qmath_test.c	Thu Aug 29 07:39:31 2019	(r351596)
@@ -208,7 +208,9 @@ ATF_TC_BODY(qmulq_s64q, tc)
 {
 	s64q_t a_s64q, b_s64q, r_s64q;
 	double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
+#ifdef notyet
 	int64_t a_int, b_int;
+#endif
 	int error;
 
 	srandomdev();
@@ -231,8 +233,6 @@ ATF_TC_BODY(qmulq_s64q, tc)
 		 * test with equal precision.
 		 */
 		Q_SCVAL(b_s64q, Q_GCVAL(a_s64q));
-		a_int = Q_GIVAL(a_s64q);
-		b_int = Q_GIVAL(b_s64q);
 
 		/* Q<op>Q testing. */
 		a_dbl = Q_Q2D(a_s64q);
@@ -247,6 +247,9 @@ ATF_TC_BODY(qmulq_s64q, tc)
 
 		r_dbl = a_dbl * b_dbl;
 #ifdef notyet
+		a_int = Q_GIVAL(a_s64q);
+		b_int = Q_GIVAL(b_s64q);
+
 		maxe_dbl = fabs(((1.0 / Q_NFBITS(a_s64q)) * (double)b_int) +
 		    ((1.0 / Q_NFBITS(b_s64q)) * (double)a_int));
 #else
@@ -270,7 +273,6 @@ ATF_TC_BODY(qdivq_s64q, tc)
 {
 	s64q_t a_s64q, b_s64q, r_s64q;
 	double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
-	int64_t a_int, b_int;
 	int error;
 
 	srandomdev();
@@ -283,8 +285,6 @@ ATF_TC_BODY(qdivq_s64q, tc)
 		 * test with equal precision.
 		 */
 		Q_SCVAL(b_s64q, Q_GCVAL(a_s64q));
-		a_int = Q_GIVAL(a_s64q);
-		b_int = Q_GIVAL(b_s64q);
 
 		/* Q<op>Q testing. */
 		a_dbl = Q_Q2D(a_s64q);
@@ -318,7 +318,6 @@ ATF_TC_BODY(qaddq_s64q, tc)
 {
 	s64q_t a_s64q, b_s64q, r_s64q;
 	double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
-	int64_t a_int, b_int;
 	int error;
 
 	srandomdev();
@@ -331,8 +330,6 @@ ATF_TC_BODY(qaddq_s64q, tc)
 		 * test with equal precision.
 		 */
 		Q_SCVAL(b_s64q, Q_GCVAL(a_s64q));
-		a_int = Q_GIVAL(a_s64q);
-		b_int = Q_GIVAL(b_s64q);
 
 		/* Q<op>Q testing. */
 		a_dbl = Q_Q2D(a_s64q);
@@ -369,7 +366,6 @@ ATF_TC_BODY(qsubq_s64q, tc)
 {
 	s64q_t a_s64q, b_s64q, r_s64q;
 	double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
-	int64_t a_int, b_int;
 	int error;
 
 	srandomdev();
@@ -382,8 +378,6 @@ ATF_TC_BODY(qsubq_s64q, tc)
 		 * test with equal precision.
 		 */
 		Q_SCVAL(b_s64q, Q_GCVAL(a_s64q));
-		a_int = Q_GIVAL(a_s64q);
-		b_int = Q_GIVAL(b_s64q);
 
 		/* Q<op>Q testing. */
 		a_dbl = Q_Q2D(a_s64q);



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