Patchwork Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm

login
register
mail settings
Submitter H.J. Lu
Date Oct. 4, 2017, 9:36 p.m.
Message ID <CAMe9rOr-uKKn3n3PXoK6-y3mibhkyfRbyYs0iJ3xQyunrq9F-A@mail.gmail.com>
Download mbox | patch
Permalink /patch/23335/
State New
Headers show

Comments

H.J. Lu - Oct. 4, 2017, 9:36 p.m.
On 10/4/17, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/04/2017 03:15 PM, Joseph Myers wrote:
>> On Wed, 4 Oct 2017, H.J. Lu wrote:
>>
>>> This is what I checked in.
>>
>> This fix doesn't seem to be on 2.26 branch, but needs to go there as the
>> original patch went there.
>>
>> I don't think using an int count of errors and returning it from do_test
>> is a good coding pattern, because if the count reaches 77 it will result
>> in a spurious UNSUPPORTED result.  Of course in this particular test it
>> can't reach 77, but a better pattern is either a boolean error state (set
>> to true rather than using ++, given the warning quoted here), or a count
>> but with do_test returning errors != 0.
>
> Agreed.  Note that TEST_VERIFY allows the test to continue after a
> failure, and it also arranges for a non-zero exit status (even across
> fork, but currently not across dlopen).  It's usually a good alternative
> to such error variables.
>
> Thanks,
> Florian
>

i am testing this patch and will backport these 2 patches to 2.26 branch.

Patch

From 758f1bfa2a1bccb52f1b3e97444a367d35aceaee Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 4 Oct 2017 14:31:16 -0700
Subject: [PATCH] test-math-iscanonical.cc: Return errors != 0

Since not all non-zero error counts are errors, return errors != 0
instead.

	* math/test-math-iscanonical.cc (do_test): Return errors != 0.
---
 ChangeLog                     | 4 ++++
 math/test-math-iscanonical.cc | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 4d94f133dc..c1fd8a7993 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@ 
+2017-10-04  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* math/test-math-iscanonical.cc (do_test): Return errors != 0.
+
 2017-10-04  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/ieee754/dbl-64/s_fma.c: Include <libm-alias-double.h>.
diff --git a/math/test-math-iscanonical.cc b/math/test-math-iscanonical.cc
index 8ced7a73b4..4cfb1c5055 100644
--- a/math/test-math-iscanonical.cc
+++ b/math/test-math-iscanonical.cc
@@ -42,7 +42,7 @@  do_test (void)
 #if __HAVE_DISTINCT_FLOAT128
   check_type<_Float128> ();
 #endif
-  return errors;
+  return errors != 0;
 }
 
 #include <support/test-driver.c>
-- 
2.13.6