This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! There were 2 bugs in strtold{,_l} if RETURN_LIMB_SIZE > 2 (e.g. IEEE quad long double on 32-bit architecture). 1) when clearing the rest of retval, it assumed there are at most 2 limbs 2) when shifting up by BITS_PER_MP_LIMB * empty bits, there was an off-by-one and no clearing of the bottom-most limbs 2004-03-24 Jakub Jelinek <jakub@redhat.com> * stdlib/strtod_l.c (INTERNAL (__STRTOF)): Clear the rest of retval, not just one limb if RETURN_LIMB_SIZE > 2. Fix shifting up if RETURN_LIMB_SIZE > 2. --- libc/stdlib/strtod_l.c.jj 2004-03-24 13:45:24.000000000 -0500 +++ libc/stdlib/strtod_l.c 2004-03-24 14:14:18.000000000 -0500 @@ -1159,7 +1159,11 @@ INTERNAL (__STRTOF) (nptr, endptr, group memcpy (retval, num, numsize * sizeof (mp_limb_t)); #if RETURN_LIMB_SIZE > 1 if (numsize < RETURN_LIMB_SIZE) +# if RETURN_LIMB_SIZE == 2 retval[numsize] = 0; +# else + MPN_ZERO (retval + numsize, RETURN_LIMB_SIZE - numsize); +# endif #endif } @@ -1465,8 +1469,10 @@ INTERNAL (__STRTOF) (nptr, endptr, group __mpn_lshift_1 (retval, RETURN_LIMB_SIZE, BITS_PER_MP_LIMB, 0); #else - for (i = RETURN_LIMB_SIZE; i > empty; --i) + for (i = RETURN_LIMB_SIZE - 1; i >= empty; --i) retval[i] = retval[i - empty]; + while (i >= 0) + retval[i--] = 0; #endif for (i = numsize; i > 0; --i) num[i + empty] = num[i - 1]; Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |