soft-fp: fix _FP_DIV_MEAT_* returning results with wrong exponent (bug 16032).

This commit is contained in:
Joseph Myers 2013-10-12 12:18:55 +00:00
parent 99fd9f47ef
commit 8399acaf7c
4 changed files with 16 additions and 5 deletions

View File

@ -1,5 +1,16 @@
2013-10-12 Joseph Myers <joseph@codesourcery.com>
[BZ #16032]
* soft-fp/op-2.h (_FP_DIV_MEAT_2_udiv): Shift numerator right
without decrementing exponent if mantissa >= that for the
denominator, not >.
(_FP_DIV_MEAT_2_gmp): Test numerator mantissa >= that for the
denominator, not >. Decrement exponent in < case instead of
incrementing in >= case.
* soft-fp/op-4.h (_FP_DIV_MEAT_4_udiv): Shift numerator right
without decrementing exponent if mantissa >= that for the
denominator, not >.
* soft-fp/op-common.h (_FP_TO_INT): Reverse test of sign for
computing saturated result for unsigned overflow.

2
NEWS
View File

@ -14,7 +14,7 @@ Version 2.19
15723, 15734, 15735, 15736, 15748, 15749, 15754, 15760, 15797, 15844,
15849, 15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892,
15893, 15895, 15897, 15905, 15909, 15919, 15921, 15923, 15939, 15963,
15966, 15988, 16034.
15966, 15988, 16032, 16034.
* CVE-2012-4412 The strcoll implementation caches indices and rules for
large collation sequences to optimize multiple passes. This cache

View File

@ -469,7 +469,7 @@
#define _FP_DIV_MEAT_2_udiv(fs, R, X, Y) \
do { \
_FP_W_TYPE _n_f2, _n_f1, _n_f0, _r_f1, _r_f0, _m_f1, _m_f0; \
if (_FP_FRAC_GT_2(X, Y)) \
if (_FP_FRAC_GE_2(X, Y)) \
{ \
_n_f2 = X##_f1 >> 1; \
_n_f1 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
@ -539,9 +539,8 @@
_FP_W_TYPE _x[4], _y[2], _z[4]; \
_y[0] = Y##_f0; _y[1] = Y##_f1; \
_x[0] = _x[3] = 0; \
if (_FP_FRAC_GT_2(X, Y)) \
if (_FP_FRAC_GE_2(X, Y)) \
{ \
R##_e++; \
_x[1] = (X##_f0 << (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE) | \
X##_f1 >> (_FP_W_TYPE_SIZE - \
(_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE))); \
@ -549,6 +548,7 @@
} \
else \
{ \
R##_e--; \
_x[1] = (X##_f0 << (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE) | \
X##_f1 >> (_FP_W_TYPE_SIZE - \
(_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE))); \

View File

@ -381,7 +381,7 @@
int _i; \
_FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m); \
_FP_FRAC_SET_4(_n, _FP_ZEROFRAC_4); \
if (_FP_FRAC_GT_4(X, Y)) \
if (_FP_FRAC_GE_4(X, Y)) \
{ \
_n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
_FP_FRAC_SRL_4(X, 1); \