public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] math/test-tgmath2: Fix fabs failure when no long double
@ 2021-01-15  2:25 Stafford Horne
  0 siblings, 0 replies; only message in thread
From: Stafford Horne @ 2021-01-15  2:25 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cc528f9a7e51f769ea79a9c413af417671bcc695

commit cc528f9a7e51f769ea79a9c413af417671bcc695
Author: Stafford Horne <shorne@gmail.com>
Date:   Fri Jan 8 06:45:36 2021 +0900

    math/test-tgmath2: Fix fabs failure when no long double
    
    I have been testing with GCC trunk and GLIBC master while working on the
    OpenRISC port.  This test has been failing with fabs not being called,
    This is caused as my architecture is configure with no long double
    meaning the two calls are the same:
    
      TEST (fabs (Vdouble1), double, fabs);
      TEST (fabs (Vldouble1), ldouble, fabs);
    
    Instead of the tgmath calls resolving to fabs and fabsl both calls are
    fabs.  Next, do to compiler optimiations the second call is eliminated.
    Fix this by invoking the failing TEST with Vldouble2.
    
    Note, I also updated the FAIL message to more clearly show where the
    failure happened, so I see:
    
      FAIL: math/test-tgmath2
      original exit status 1
      wrong function called, fabs (ldouble) failure on line 174
    
    Cc: Joseph Myers <joseph@codesourcery.com>

Diff:
---
 math/test-tgmath2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c
index 14a3453169..b8fb00c566 100644
--- a/math/test-tgmath2.c
+++ b/math/test-tgmath2.c
@@ -122,7 +122,7 @@ int counts[Tlast][C_last];
       __asm __volatile ("" : : "r" (&texpr));			\
       if (count != 1 || counts[T##type][C_##fn] != 1)		\
 	{							\
-	  FAIL ("wrong function called");			\
+	  FAIL ("wrong function called, "#fn" ("#type")");	\
 	  memset (counts, 0, sizeof (counts));			\
 	}							\
       count = 0;						\
@@ -171,7 +171,7 @@ test_fabs (const int Vint4, const long long int Vllong4)
   TEST (fabs (vcldouble1), ldouble, cabs);
   TEST (fabs (Vfloat1), float, fabs);
   TEST (fabs (Vdouble1), double, fabs);
-  TEST (fabs (Vldouble1), ldouble, fabs);
+  TEST (fabs (Vldouble2), ldouble, fabs);
 #ifndef __OPTIMIZE__
   /* GCC is too smart to optimize these out.  */
   TEST (fabs (Vint1), double, fabs);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-15  2:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  2:25 [glibc] math/test-tgmath2: Fix fabs failure when no long double Stafford Horne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).