On Wed, Dec 17, 2025 at 06:56:16PM +0000, Jonathan Wakely wrote:
> I suspect what's happening is that the rounding in this loop changes:
>
> while (true)
> {
> _UInt __Ri{1};
> _UInt __sum{__urng() - _Urbg::min()};
> for (int __i = __k - 1; __i > 0; --__i)
> {
> __Ri *= __R;
> __sum += _UInt{__urng() - _Urbg::min()} * __Ri;
> }
> const _RealT __ret = _RealT(__sum / __x) / _RealT(__rd);
> if (__ret < _RealT(1.0))
> return __ret;
I think the problem is that the test is compiled with -O2 -m32 -std=gnu++20.
And that defaults to the -fexcess-precision=fast mode, which is the fast
unpredictable mode. If it is compiled with -O2 -m32 -std=c++20 (where
-fexcess-precision=standard is the default), or
-O2 -m32 -std=gnu++20 -msse2 -mfpmath=sse (where there is no excess
precision) or -O2 -m32 -std=gnu++20 -fexcess-precision=standard, it works
fine.
So, I'd go for dg-additional-options -fexcess-precision=standard for this
and the other test.
Jakub