re PR libgcc/78067 (libgcc2 calls count_leading_zero with 0)

2016-11-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR libgcc/78067
        * libgcc2.c (__floatdisf, __floatdidf): Avoid undefined results from
        count_leading_zeros.

testsuite:
2016-11-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR libgcc/78067
        * gcc.dg/torture/fp-int-convert.h: Add more conversion tests.

From-SVN: r241817
This commit is contained in:
Bernd Edlinger 2016-11-03 12:52:19 +00:00 committed by Bernd Edlinger
parent 4098e9b907
commit 5de3e2d862
4 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2016-11-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR libgcc/78067
* gcc.dg/torture/fp-int-convert.h: Add more conversion tests.
2016-11-03 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.c-torture/execute/pr78170.c: Require int32plus.

View File

@ -53,6 +53,8 @@ do { \
TEST_I_F_VAL (U, F, HVAL1U (P, U), P_OK (P, U)); \
TEST_I_F_VAL (U, F, HVAL1U (P, U) + 1, P_OK (P, U)); \
TEST_I_F_VAL (U, F, HVAL1U (P, U) - 1, P_OK (P, U)); \
TEST_I_F_VAL (I, F, WVAL0S (I), 1); \
TEST_I_F_VAL (I, F, -WVAL0S (I), 1); \
} while (0)
#define P_OK(P, T) ((P) >= sizeof(T) * CHAR_BIT)
@ -74,6 +76,7 @@ do { \
? (S)1 \
: (((S)1 << (sizeof(S) * CHAR_BIT - 2)) \
+ ((S)3 << (sizeof(S) * CHAR_BIT - 2 - P))))
#define WVAL0S(S) (S)((S)1 << (sizeof(S) * CHAR_BIT / 2 - 1))
#define TEST_I_F_VAL(IT, FT, VAL, PREC_OK) \
do { \

View File

@ -1,3 +1,9 @@
2016-11-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR libgcc/78067
* libgcc2.c (__floatdisf, __floatdidf): Avoid undefined results from
count_leading_zeros.
2016-11-02 Uros Bizjak <ubizjak@gmail.com>
* Makefile.in (LIB2_DIVMOD_FUNCS): Add _divmoddi4.

View File

@ -1674,6 +1674,11 @@ FUNC (DWtype u)
hi = -(UWtype) hi;
UWtype count, shift;
#if !defined (COUNT_LEADING_ZEROS_0) || COUNT_LEADING_ZEROS_0 != W_TYPE_SIZE
if (hi == 0)
count = W_TYPE_SIZE;
else
#endif
count_leading_zeros (count, hi);
/* No leading bits means u == minimum. */