]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use volatile global counters in test-tgmath.c.
authorStefan Liebler <stli@linux.vnet.ibm.com>
Thu, 19 Apr 2018 10:32:50 +0000 (12:32 +0200)
committerStefan Liebler <stli@linux.vnet.ibm.com>
Thu, 19 Apr 2018 10:32:50 +0000 (12:32 +0200)
If build with -Os on s390x, the test-tgmath fails with:
float functions not called often enough (-10000)

Within compile_testf(), the counter (count_float) is saved
before the complex functions are called.
Afterwards the saved counter differs to the current-counter.

But the tests with the complex functions do not increment count_float!
Instead count_float is saved to a register before calling totalorder
and totalordermag which both increment count_float.
The compiler is allowed to do that as totalorderf and totalordermagf
is declared with __attribute__ ((__const__)) in math/bits/mathcalls.h.

Thus this patch adjusts the global counters to be volatile.
Then count_float is saved after totalordermag.

ChangeLog:

* math/test-tgmath.c (count_double, count_float,
count_ldouble, count_cdouble, count_cfloat,
count_cldouble): Use volatile int.

ChangeLog
math/test-tgmath.c

index ec19da47f2d30c15a5555971b9fe1272827655c1..df941db962990ef8536dedc31128575bbd7fd9c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-19  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+       * math/test-tgmath.c (count_double, count_float,
+       count_ldouble, count_cdouble, count_cfloat,
+       count_cldouble): Use volatile int.
+
 2018-04-19  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
        * sysdeps/mach/hurd/i386/Makefile [$(subdir) = conform]
index 6d8e7fde4eb75721d8aa901857325234ed41a861..2b0787cd4a0b0f337283a3fce52c969603764c39 100644 (file)
@@ -45,12 +45,12 @@ complex float fz;
 complex double dz;
 complex long double lz;
 
-int count_double;
-int count_float;
-int count_ldouble;
-int count_cdouble;
-int count_cfloat;
-int count_cldouble;
+volatile int count_double;
+volatile int count_float;
+volatile int count_ldouble;
+volatile int count_cdouble;
+volatile int count_cfloat;
+volatile int count_cldouble;
 
 #define NCALLS     134
 #define NCALLS_INT 4