https://gcc.gnu.org/g:a9eb2f24b01bea3193bdb77cc2aa13d6fbd0f754

commit r16-6226-ga9eb2f24b01bea3193bdb77cc2aa13d6fbd0f754
Author: Jonathan Wakely <[email protected]>
Date:   Wed Dec 17 19:39:39 2025 +0000

    libstdc++: Use -fexcess-precision=standard for std::generate_canonical tests
    
    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 <[email protected]>

Diff:
---
 .../26_numerics/random/uniform_real_distribution/operators/64351.cc      | 1 +
 .../26_numerics/random/uniform_real_distribution/operators/gencanon.cc   | 1 +
 2 files changed, 2 insertions(+)

diff --git 
a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
 
b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
index 3031984df15a..f457bc6e0fc9 100644
--- 
a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
+++ 
b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
@@ -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>
diff --git 
a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
 
b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
index 87ad206a78a4..69a061071da0 100644
--- 
a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
+++ 
b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
@@ -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>

Reply via email to