]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use -fexcess-precision=standard for std::generate_canonical tests
authorJonathan Wakely <jwakely@redhat.com>
Wed, 17 Dec 2025 19:39:39 +0000 (19:39 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 17 Dec 2025 20:41:31 +0000 (20:41 +0000)
On 32-bit x86 the default -fexcess-precision=fast setting used by
-std=gnu++20 results in unpredictable rounding which alters the number
of times that std::generate_canonical produces exactly 1.0f, which
means that the URBG is invoked a different number of times.

To ensure that the behaviour is consistent and the expected number of
calls happens, use -fexcess-precision=standard.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc:
Add -fexcess-precision=standard to options.
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Likewise.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc

index 3031984df15a4e17e46627133cf49d0295038097..f457bc6e0fc9b5cb5eee9e2bc004afc54289c5f6 100644 (file)
@@ -17,6 +17,7 @@
 
 // { dg-do run { target { c++11 && { ! simulator } } } }
 // { dg-require-cstdint "" }
+// { dg-additional-options -fexcess-precision=standard }
 
 #include <random>
 #include <testsuite_hooks.h>
index 87ad206a78a464de013e66755fff77881d0667b2..69a061071da09fe75e1ecd8a75f5fe8c579b768d 100644 (file)
@@ -1,5 +1,6 @@
 // { dg-do run { target { c++11 && { ! simulator } } } }
 // { dg-skip-if "requires new impl" { *-*-* } { -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL=1 } }
+// { dg-additional-options -fexcess-precision=standard }
 
 #include <random>
 #include <limits>