]> Savannah Git Hosting - gnulib.git/commitdiff
floorf, ceilf tests: Strengthen against compiler optimizations.
authorBruno Haible <bruno@clisp.org>
Fri, 24 Nov 2023 19:02:37 +0000 (20:02 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 18 Jan 2024 08:12:29 +0000 (09:12 +0100)
Reported by RenĂ© Rebe <rene@t2-project.org>.

* tests/test-floorf1.c (main): Mark my_floorf as 'volatile'.
* tests/test-floorf-ieee.c (main): Likewise.
* tests/test-ceilf1.c (main): Mark my_ceilf as 'volatile'.
* tests/test-ceilf-ieee.c (main): Likewise.

ChangeLog
tests/test-ceilf-ieee.c
tests/test-ceilf1.c
tests/test-floorf-ieee.c
tests/test-floorf1.c

index 07ea51bd44432ec296251ae8dbec059949b7c6d0..9e3826c6f25f44148dda6d9b1435252d70c6708f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-11-24  Bruno Haible  <bruno@clisp.org>
+
+       floorf, ceilf tests: Strengthen against compiler optimizations.
+       Reported by RenĂ© Rebe <rene@t2-project.org>.
+       * tests/test-floorf1.c (main): Mark my_floorf as 'volatile'.
+       * tests/test-floorf-ieee.c (main): Likewise.
+       * tests/test-ceilf1.c (main): Mark my_ceilf as 'volatile'.
+       * tests/test-ceilf-ieee.c (main): Likewise.
+
 2023-11-21  Bruno Haible  <bruno@clisp.org>
 
        strerrorname_np: Work around glibc bug on HPPA systems.
index 02edc0d92ac02615f920541aa0fc37d34467b4ad..bfdceee1c5e92fa0708c1a85549896aa0653129f 100644 (file)
@@ -38,7 +38,7 @@ dummy (float f)
 int
 main (int argc, _GL_UNUSED char **argv)
 {
-  float (*my_ceilf) (float) = argc ? ceilf : dummy;
+  float (* volatile my_ceilf) (float) = argc ? ceilf : dummy;
 
   /* See IEEE 754, section 6.3:
        "the sign of the result of the round floating-point number to
index 61a4ae99b5a37912f5f0e189bc2793ce86d25f49..2ad2b30fb071d301334630ab5a8885e74875abea 100644 (file)
@@ -43,7 +43,7 @@ dummy (float f)
 int
 main (int argc, _GL_UNUSED char **argv)
 {
-  float (*my_ceilf) (float) = argc ? ceilf : dummy;
+  float (* volatile my_ceilf) (float) = argc ? ceilf : dummy;
 
   /* Zero.  */
   ASSERT (my_ceilf (0.0f) == 0.0f);
index 32ceb5b7b134dbe90a9b8629c445c4291a4f8c8d..8b1a02ac89bdaa65c109b8f669858abbc223f1e5 100644 (file)
@@ -38,7 +38,7 @@ dummy (float f)
 int
 main (int argc, _GL_UNUSED char **argv)
 {
-  float (*my_floorf) (float) = argc ? floorf : dummy;
+  float (* volatile my_floorf) (float) = argc ? floorf : dummy;
 
   /* See IEEE 754, section 6.3:
        "the sign of the result of the round floating-point number to
index b2787f6ff34b505431e749e8e6efce34d5b8671d..39b7a484324f21e43e424ce1e00cdb90eab335c5 100644 (file)
@@ -43,7 +43,7 @@ dummy (float f)
 int
 main (int argc, _GL_UNUSED char **argv)
 {
-  float (*my_floorf) (float) = argc ? floorf : dummy;
+  float (* volatile my_floorf) (float) = argc ? floorf : dummy;
 
   /* Zero.  */
   ASSERT (my_floorf (0.0f) == 0.0f);