Message ID | alpine.DEB.2.21.2006051859440.13777@digraph.polyomino.org.uk |
---|---|
State | New |
Headers | show |
Series | softfloat, target/i386: fprem, fprem1 fixes | expand |
On 6/5/20 12:00 PM, Joseph Myers wrote: > The floatx80 remainder implementation ignores the high bit of the > significand when checking whether an operand (numerator) with zero > exponent is zero. This means it mishandles a pseudo-denormal > representation of 0x1p-16382L by treating it as zero. Fix this by > checking the whole significand instead. > > Signed-off-by: Joseph Myers <joseph@codesourcery.com> > --- > fpu/softfloat.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 7b1ce7664f..091847beb9 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5726,7 +5726,7 @@ floatx80 floatx80_modrem(floatx80 a, floatx80 b, bool mod, normalizeFloatx80Subnormal( bSig, &bExp, &bSig ); } if ( aExp == 0 ) { - if ( (uint64_t) ( aSig0<<1 ) == 0 ) return a; + if ( aSig0 == 0 ) return a; normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 ); } bSig |= UINT64_C(0x8000000000000000);
The floatx80 remainder implementation ignores the high bit of the significand when checking whether an operand (numerator) with zero exponent is zero. This means it mishandles a pseudo-denormal representation of 0x1p-16382L by treating it as zero. Fix this by checking the whole significand instead. Signed-off-by: Joseph Myers <joseph@codesourcery.com> --- fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)