On Wed, 17 Dec 2025, 06:55 Jakub Jelinek, <[email protected]> wrote: > On Tue, Dec 16, 2025 at 02:52:27PM -0500, Nathan Myers wrote: > > PR libstdc++/119739 > > * include/bits/random.tcc: Add generate_canonical impl for C++26. > > * > testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc: > > Adapt test for both pre- and post- C++26. > > * > testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc: > > Test for float and double from 32-bit RNG, including 1.0 do-over. > > This breaks some tests. > On x86_64-linux > FAIL: 17_intro/headers/c++1998/all_pedantic_errors.cc -std=gnu++17 (test > for excess errors) > Excess errors: > /home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3681: > error: ISO C++ does not support '__int128' for 'type name' [-Wpedantic] > /home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3698: > error: ISO C++ does not support '__int128' for 'type name' [-Wpedantic] > for which I'm attaching patch below, > FAIL: std/ranges/adaptors/93978.cc -std=gnu++20 (test for excess errors) > Excess errors: > /home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3664: > warning: typedef 'using _Rng = decltype (_Urbg::max())' locally defined but > not used [-Wunused-local-typedefs] > FAIL: std/ranges/adaptors/93978.cc -std=gnu++26 (test for excess errors) > Excess errors: > /home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3664: > warning: typedef 'using _Rng = decltype (_Urbg::max())' locally defined but > not used [-Wunused-local-typedefs] > where that > using _Rng = decltype(_Urbg::max()); > indeed looks unused and it is unclear if you want to use > it somewhere or remove, > FAIL: 26_numerics/random/pr60037-neg.cc -std=gnu++17 (test for errors, > line 3480) > FAIL: 26_numerics/random/pr60037-neg.cc -std=gnu++17 (test for excess > errors) > Excess errors: > /home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3653: > error: static assertion failed: template argument must be floating point > and on i686-linux tons of further FAILs like: > FAIL: 26_numerics/random/fisher_f_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > Excess errors: > /home/jakub/src/gcc/obj21/i686-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3700: > error: static assertion failed: irregular RNG with float precision >32 > requires __int128 support > /home/jakub/src/gcc/obj21/i686-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3705: > warning: no return statement in function returning non-void [-Wreturn-type] > UNRESOLVED: > 26_numerics/random/fisher_f_distribution/operators/serialize.cc > -std=gnu++17 compilation failed to produce executable > I think it is all of > FAIL: 20_util/is_function/91371.cc -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/bernoulli_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/binomial_distribution/114359.cc -std=gnu++17 > (test for excess errors) > FAIL: 26_numerics/random/binomial_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/cauchy_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/chi_squared_distribution/83833.cc -std=gnu++17 > (test for excess errors) > FAIL: 26_numerics/random/chi_squared_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/discrete_distribution/operators/call-default.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/discrete_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/exponential_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/extreme_value_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/fisher_f_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/gamma_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/geometric_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/lognormal_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/negative_binomial_distribution/operators/58302.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/negative_binomial_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/normal_distribution/operators/equal.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/normal_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/piecewise_constant_distribution/operators/call-default.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/piecewise_constant_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/piecewise_linear_distribution/operators/call-default.cc > -std=gnu++17 (test for excess errors) > FAIL: > 26_numerics/random/piecewise_linear_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/poisson_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/pr60037-neg.cc -std=gnu++17 (test for errors, > line 3480) > FAIL: 26_numerics/random/pr60037-neg.cc -std=gnu++17 (test for excess > errors) > FAIL: 26_numerics/random/student_t_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/uniform_real_distribution/operators/64351.cc > -std=gnu++17 execution test > FAIL: 26_numerics/random/uniform_real_distribution/operators/gencanon.cc > -std=gnu++17 execution test > FAIL: 26_numerics/random/uniform_real_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: 26_numerics/random/weibull_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/arcsine_distribution/operators/serialize.cc -std=gnu++17 > (test for excess errors) > FAIL: ext/random/beta_distribution/operators/serialize.cc -std=gnu++17 > (test for excess errors) > FAIL: ext/random/hoyt_distribution/operators/serialize.cc -std=gnu++17 > (test for excess errors) > FAIL: ext/random/hypergeometric_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/k_distribution/operators/serialize.cc -std=gnu++17 (test > for excess errors) > FAIL: ext/random/logistic_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/nakagami_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/normal_mv_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/pareto_distribution/operators/serialize.cc -std=gnu++17 > (test for excess errors) > FAIL: ext/random/rice_distribution/operators/serialize.cc -std=gnu++17 > (test for excess errors) > FAIL: ext/random/triangular_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/uniform_inside_sphere_distribution/operators/generate.cc > -std=gnu++17 (test for excess errors) > FAIL: > ext/random/uniform_inside_sphere_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/uniform_on_sphere_distribution/operators/generate.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/uniform_on_sphere_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > FAIL: ext/random/von_mises_distribution/operators/serialize.cc > -std=gnu++17 (test for excess errors) > Because we don't have unsigned _BitInt(128) in C++ right now, I'm afraid > you > want some unsigned __int128 like class for #ifndef __SIZEOF_INT128__ which > will handle all the operations you need on a pair of unsigned long long. > > Note, some time ago I was working on an int128 and uint128 for libgcobol, > https://gcc.gnu.org/bugzilla/attachment.cgi?id=61011 is the latest patch > (part of https://gcc.gnu.org/PR119595), it probably has far more than > you actually need and not the libstdc++-v3 formatting. > > Anyway, here is just the quick __extension__ patch to fix up > all_pedantic_errors.cc. > > Ok for trunk? >
OK, thanks > 2025-12-17 Jakub Jelinek <[email protected]> > > * include/bits/random.tcc (std::generate_canonical): Use > __extension__ before __generate_canonical_{pow2,any} calls with > unsigned __int128 template arguments. > > --- libstdc++-v3/include/bits/random.tcc.jj 2025-12-16 > 22:26:28.485419458 +0100 > +++ libstdc++-v3/include/bits/random.tcc 2025-12-17 > 07:25:12.633790536 +0100 > @@ -3677,7 +3677,7 @@ namespace __detail > { > #if defined(__SIZEOF_INT128__) > // Accommodate double double or float128. > - return __generate_canonical_pow2< > + return __extension__ __generate_canonical_pow2< > _RealT, unsigned __int128, __d>(__urng); > #else > static_assert(false, > @@ -3694,7 +3694,7 @@ namespace __detail > #if defined(__SIZEOF_INT128__) > static_assert(__d <= 64, > "irregular RNG with float precision >64 is not supported"); > - return __generate_canonical_any< > + return __extension__ __generate_canonical_any< > _RealT, unsigned __int128, __d>(__urng); > #else > static_assert(false, "irregular RNG with float precision" > > > Jakub > >
