bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exp* tests: Work around clang 6.0.1 optimization bugs on x86


From: Bruno Haible
Subject: exp* tests: Work around clang 6.0.1 optimization bugs on x86
Date: Sat, 09 Jan 2021 12:54:03 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

On FreeBSD 12.0/x86 I'm seeing these test failures:

FAIL: test-expf-ieee
====================

../../gltests/test-exp-ieee.h:25: assertion 'z == L_(0.0)' failed
FAIL test-expf-ieee (exit status: 134)

FAIL: test-exp2-ieee
====================

../../gltests/test-exp2-ieee.h:25: assertion 'z == L_(0.0)' failed
FAIL test-exp2-ieee (exit status: 134)

FAIL: test-exp2f-ieee
=====================

../../gltests/test-exp2-ieee.h:25: assertion 'z == L_(0.0)' failed
FAIL test-exp2f-ieee (exit status: 134)

It turns out that the libc functions are OK, and the wrong function values
occur only through cc's -O2 optimization.

This patch works around it.


2021-01-09  Bruno Haible  <bruno@clisp.org>

        exp* tests: Work around clang 6.0.1 optimization bugs on x86.
        * tests/test-exp-ieee.h (test_function): Mark some variable as
        'volatile'.
        * tests/test-exp2-ieee.h (test_function): Likewise.

diff --git a/tests/test-exp-ieee.h b/tests/test-exp-ieee.h
index 7e898a5..c426feb 100644
--- a/tests/test-exp-ieee.h
+++ b/tests/test-exp-ieee.h
@@ -21,7 +21,7 @@ test_function (void)
 
   /* Underflow.  */
   {
-    DOUBLE z = EXP (-100000.0);
+    volatile DOUBLE z = EXP (-100000.0);
     ASSERT (z == L_(0.0));
     ASSERT (!signbit (z));
   }
diff --git a/tests/test-exp2-ieee.h b/tests/test-exp2-ieee.h
index 9a3a196..8b57454 100644
--- a/tests/test-exp2-ieee.h
+++ b/tests/test-exp2-ieee.h
@@ -21,7 +21,7 @@ test_function (void)
 
   /* Underflow.  */
   {
-    DOUBLE z = EXP2 (-100000.0);
+    volatile DOUBLE z = EXP2 (-100000.0);
     ASSERT (z == L_(0.0));
     ASSERT (!signbit (z));
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]