This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.25-623-gd12a22c
- From: jsm28 at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 28 Jun 2017 16:31:36 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.25-623-gd12a22c
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via d12a22c5d351cd1cc125a6345a949dfbc20f6f91 (commit)
from cfa44345234e161cb59987ed70e04719ba155867 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d12a22c5d351cd1cc125a6345a949dfbc20f6f91
commit d12a22c5d351cd1cc125a6345a949dfbc20f6f91
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Jun 28 16:31:10 2017 +0000
Fix tgmath.h totalorder, totalordermag return type (bug 21687).
The tgmath.h totalorder and totalordermag macros wrongly return a
floating-point type. They should return int, like the underlying
functions. This patch fixes them accordingly, updating tests
including enabling tests of those functions from gen-tgmath-tests.py.
Tested for x86_64.
[BZ #21687]
* math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
(totalorder): Use it.
(totalordermag): Likewise.
* math/gen-tgmath-tests.py (Tests.add_all_tests): Enable tests of
totalorder and totalordermag.
* math/test-tgmath.c (F(compile_test)): Do not call totalorder or
totalordermag in arguments of calls to those functions.
(NCALLS): Change to 134.
diff --git a/ChangeLog b/ChangeLog
index a198363..1d11b9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2017-06-28 Joseph Myers <joseph@codesourcery.com>
+ [BZ #21687]
+ * math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
+ (totalorder): Use it.
+ (totalordermag): Likewise.
+ * math/gen-tgmath-tests.py (Tests.add_all_tests): Enable tests of
+ totalorder and totalordermag.
+ * math/test-tgmath.c (F(compile_test)): Do not call totalorder or
+ totalordermag in arguments of calls to those functions.
+ (NCALLS): Change to 134.
+
* math/tgmath.h (__TGMATH_UNARY_REAL_RET_ONLY): Do not take or
cast to return type argument.
(__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 3dbd874..db6553e 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -549,8 +549,8 @@ class Tests(object):
self.add_tests('fromfpx', 'intmax_t', ['r', 'int', 'unsigned int'])
self.add_tests('ufromfp', 'uintmax_t', ['r', 'int', 'unsigned int'])
self.add_tests('ufromfpx', 'uintmax_t', ['r', 'int', 'unsigned int'])
- #self.add_tests('totalorder', 'int', ['r', 'r'])
- #self.add_tests('totalordermag', 'int', ['r', 'r'])
+ self.add_tests('totalorder', 'int', ['r', 'r'])
+ self.add_tests('totalordermag', 'int', ['r', 'r'])
# The functions that round their result to a narrower type,
# and the associated type-generic macros, are not yet
# supported by this script or by glibc.
diff --git a/math/test-tgmath.c b/math/test-tgmath.c
index dc24cd6..0f3e2e5 100644
--- a/math/test-tgmath.c
+++ b/math/test-tgmath.c
@@ -52,7 +52,7 @@ int count_cdouble;
int count_cfloat;
int count_cldouble;
-#define NCALLS 138
+#define NCALLS 134
#define NCALLS_INT 4
#define NCCALLS 47
@@ -295,8 +295,8 @@ F(compile_test) (void)
b = fmaxmag (fmaxmag (a, x), fmaxmag (c, b));
a = fminmag (fminmag (x, a), fminmag (c, b));
b = fma (sin (a), sin (x), sin (c));
- a = totalorder (totalorder (x, b), totalorder (c, x));
- b = totalordermag (totalordermag (x, a), totalordermag (c, x));
+ a = totalorder (x, b);
+ b = totalordermag (x, a);
#ifdef TEST_INT
a = atan2 (i, b);
diff --git a/math/tgmath.h b/math/tgmath.h
index a70dfe1..a0da104 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -112,6 +112,18 @@
+ (__tgmath_real_type (Val2)) 0)) \
Fct##f (Val1, Val2)))
+# define __TGMATH_BINARY_REAL_RET_ONLY(Val1, Val2, Fct) \
+ (__extension__ (((sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double)) \
+ && __builtin_classify_type ((Val1) + (Val2)) == 8) \
+ ? __tgml(Fct) (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8 \
+ || __builtin_classify_type (Val2) != 8) \
+ ? Fct (Val1, Val2) \
+ : Fct##f (Val1, Val2)))
+
# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
(__extension__ (((sizeof (Val1) > sizeof (double) \
|| sizeof (Val2) > sizeof (double)) \
@@ -471,12 +483,12 @@
# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
/* Total order operation. */
-# define totalorder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
- totalorder)
+# define totalorder(Val1, Val2) \
+ __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalorder)
/* Total order operation on absolute values. */
-# define totalordermag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
- totalordermag)
+# define totalordermag(Val1, Val2) \
+ __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalordermag)
#endif
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 10 ++++++++++
math/gen-tgmath-tests.py | 4 ++--
math/test-tgmath.c | 6 +++---
math/tgmath.h | 20 ++++++++++++++++----
4 files changed, 31 insertions(+), 9 deletions(-)
hooks/post-receive
--
GNU C Library master sources