[svn-r4423] Purpose:

Thread-safety Bug Fixes
Description:
    FreeBSD must use a different layout or mechanism for allocating objects on
    the stack when compiling for thread-safe operation.  Unused bits in 'long
    double' variable are never used ('long double's on FreeBSD are stored in
    12 bytes, but only use 10 bytes for computations), but set to different
    values, causing the endianness permutation testing to generate incorrect
    results and eventually fail an assertion.
Solution:
    Clear the temporary variables used for determining the endianness permutation
    with memset (affecting all 12 bytes) instead of just assigning a 0.0 to them
    (affecting only 10 bytes)
Platforms tested:
    FreeBSD 4.4 (hawkwind)
This commit is contained in:
Quincey Koziol 2001-09-04 16:22:29 -05:00
parent dc5a388f8d
commit efda170169

View File

@ -203,6 +203,12 @@ precision (detected_t *d)
INFO.varname = #VAR; \
INFO.size = sizeof(TYPE); \
\
/* Completely initialize temporary variables, in case the bits used in */ \
/* the type take less space than the number of bits used to store the type */ \
memset(&_v3,0,sizeof(TYPE)); \
memset(&_v2,0,sizeof(TYPE)); \
memset(&_v1,0,sizeof(TYPE)); \
\
/* Byte Order */ \
for (_i=0,_v1=0.0,_v2=1.0; _i<(signed)sizeof(TYPE); _i++) { \
_v3 = _v1; _v1 += _v2; _v2 /= 256.0; \